Transient State

Transient State

In Hibernate Applications, when we create POJO object then automatically POJO object will come to Transient State.

If POJO object is available in Transient State then Hibernate Software is not aware about POJO object.

If POJO object is available in Transient State then POJO object is representing any record in Database table.

In this state, Hibernate Software is unable to provide synchronization between POJO object and record in Database.

In this state, if we perform modifications in POJO object then that modifications are not reflected to any record in Database.

If we keep POJO object in Transient State for long time then POJO object is eligible for Garbage Collection then Garbage Collector will destroy POJO object.

E.g

# Transient state start
Employee emp = new Employee();
emp.setEmpId("E0087");
emp.setEmpName("Ashok Kumar");
emp.setSalary(75000);
emp.setAddress("Hyderabad");
# Transient state end

See the above line, we just loaded the object and called the corresponding setter methods, its not related to the database row. So here

Transient State
Scroll to top