-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: FlushMode.MANUAL flushing inserting records
PostPosted: Wed Mar 14, 2012 10:36 am 
Newbie

Joined: Sat Nov 19, 2011 8:47 am
Posts: 3
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");
   }
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.