Persistence State

Persistence State

Persistent objects exist in the database, and Hibernate manages the persistence for persistent objects.

If we perform the Operations like save() , update(), saveOrUpdate().. etc. over the POJO object which is available in Transient State then POJO object will come to Persistence State.

In Hibernate Applications, if we perform the objects like get() , load(), find() etc. automatically Hibernate Software will create POJO object in Persistence State directly without Transient State.

In Persistence State, Hibernate Software is aware about POJO Object and database table record and its synchronization.

In Persistence State, if we perform modifications on POJO object then that modifications are reflected to Database table record.

E.g

// Persistence state start
Transaction tx = session.beginTransaction();
session.save(emp);
System.out.println("Employee Record inserted Succesfully");
tx.commit();
// Persistence state end  
Persistence State


Scroll to top