Login
Remember
Register
Ask a Question
What are the states of the object in hibernate?
0
votes
asked
Jan 1, 2024
in
Hibernate
by
rajeshsharma
What are the states of the object in hibernate?
object-hibernate
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Jan 1, 2024
by
rajeshsharma
There are 3 states of the object (instance) in hibernate.
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.
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.
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.
...