0 votes
in Hibernate by
What are the states of the object in hibernate?

1 Answer

0 votes
by

There are 3 states of the object (instance) in hibernate.

  1. Transient: The object is in a transient state if it is just created but has no primary key (identifier) and not associated with a session.
  2. Persistent: The object is in a persistent state if a session is open, and you just saved the instance in the database or retrieved the instance from the database.
  3. Detached: The object is in a detached state if a session is closed. After detached state, the object comes to persistent state if you call lock() or update() method.

Related questions

0 votes
asked Dec 31, 2023 in Hibernate by Robindeniel
0 votes
0 votes
asked Jun 8, 2020 in Hibernate by DavidAnderson
...