Explain the mechanism by which you can distinguish between transient (i.e. Newly instantiated) and detached objects in hibernate?
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 |
What are the two types of collections in hibernate?
What does the session object hold?
What is orm mapping in hibernate?
What is fetchtype in hibernate?
What is evict method in hibernate?
Why sessionfactory is singleton in hibernate?
Is merge better than update?
Which class elements are not persisted?
Which came first jpa or hibernate?
What are the ways to access hibernate by using spring?
What does hibernate.properties file consist of?
What is difference between opensession and getcurrentsession?