How does hibernate distinguish between transient (i.e. Newly instantiated) and detached objects?
Answer / Avinash Tripathi
Hibernate distinguishes between transient and detached objects based on their association with a Hibernate Session.n
1. Transient Objects: These are newly instantiated objects that have no persistent identity and are not associated with any session.n
2. Detached Objects: Initially, these were persistent objects associated with a Hibernate Session but are no longer associated because the session was closed or evicted.nnHibernate uses a flag called 'identity' to distinguish between transient and persistent (managed) objects. When an object is saved in the database for the first time, its identity is set to true, indicating that it's now a managed object. If the object becomes detached, the identity flag remains true, but the object is no longer associated with any session.
| Is This Answer Correct ? | 0 Yes | 0 No |
What are the extension interfaces that are there in hibernate?
Can we use hibernate with cassandra?
What are the identified limitation of hibernate?
What is entitymanager persist?
What is hibernate and spring java?
What is indexing in hibernate?
What is the architecture of hibernate?
What is transient instance state in hibernate?
What is persistent state?
How to check hibernate version in spring boot?
Is orphanremoval true?
What are the benefits of orm and hibernate?