Explain the mechanism by which you can distinguish between transient (i.e. Newly instantiated) and detached objects in hibernate?



Explain the mechanism by which you can distinguish between transient (i.e. Newly instantiated) and d..

Answer / Urvashi

Transient objects are newly created instances that have not been associated with a session, while detached objects were previously managed by a Hibernate session but have since been evicted or closed. To distinguish between them, you can check if the object's persistent property (i.e., isPersistent() method) returns false for transient objects and true for detached ones.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Hibernate Interview Questions

What are the two types of collections in hibernate?

1 Answers  


What does the session object hold?

1 Answers  


What is orm mapping in hibernate?

1 Answers  


What is fetchtype in hibernate?

1 Answers  


What is evict method in hibernate?

1 Answers  


Why sessionfactory is singleton in hibernate?

1 Answers  


Is merge better than update?

1 Answers  


Which class elements are not persisted?

1 Answers  


Which came first jpa or hibernate?

1 Answers  


What are the ways to access hibernate by using spring?

1 Answers  


What does hibernate.properties file consist of?

1 Answers  


What is difference between opensession and getcurrentsession?

1 Answers  


Categories