Google News
logo
Java Hibernates - Interview Questions
What is automatic dirty checking in hibernate?
The automatic dirty checking feature of Hibernate, calls update statement automatically on the objects that are modified in a transaction.
 
Let's understand it by the example given below :
...  
SessionFactory factory = cfg.buildSessionFactory();  
Session session1 = factory.openSession();  
Transaction tx=session2.beginTransaction();  
   
Employee e1 = (Employee) session1.get(Employee.class, Integer.valueOf(101));  
   
e1.setSalary(90000);  
   
tx.commit();  
session1.close();
Advertisement