Hi,
I set the session flush mode to MANUAL and trying to execute the below code with out flushing the session.
I was expecting no records get inserted in to the database but it got inserted. Can any one help me on this ?
Code:
public class Test {
private static SessionFactory factory = new Configuration().configure(new File("C:/yogi/workspace/EJBBook/config/hibernate_export.cfg.xml")).buildSessionFactory();
public static void main(String args[]){
Session s1 = factory.openSession();
s1.setFlushMode(FlushMode.MANUAL);
Transaction t1 = s1.getTransaction();
Customer cust1 = new Customer("ravi1234", 1222);
t1.begin();
s1.save(cust1);
t1.commit();
s1.close(); //with commenting this line too the record got executed.
System.out.println("EOD");
}
}