Explain persistence life cycle of an object?

Answer

In persistence life cycle, the object lies in the following states: -

  • Transient - The object is called to be in the transient state when it is just declared by using the new keyword. When an object remains in the transient state, it doesn't contain any identifier(primary key) in the database.
  • Persistence - In this state, an object is associated with the session and either saved to a database or retrieved from the database. When an object remains in the persistence state, It contains a row of the database and consists of an identifier value. We can make an object persistent by associating it with the hibernate session.
  • Detached - The object enters into a detached state when the hibernate session is closed. The changes made to the detached objects are not saved to the database.

All jpa Questions

Ask your interview questions on jpa

Write Your comment or Questions if you want the answers on jpa from jpa Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---