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: Hibernate do a rollback strangely
PostPosted: Wed Jan 04, 2006 2:15 pm 
Newbie

Joined: Wed Jan 04, 2006 1:16 pm
Posts: 1
Hello

I begin in hibernate and try some exemple :
here is the java code I use to record an object :

SessionFactory sessionFactory = new
Configuration().configure().buildSessionFactory();
Session session =sessionFactory.openSession();
// org.hibernate.Transaction tx = session.beginTransaction();
Users user = new Users();
user.setLogin("marcel");
user.setPassword("toto");
session.saveOrUpdate(user);
//tx.commit();
session.flush();
session.close();

the point is the if I don't use transaction commands (here commented) the insert request is executed in DB (HSQLDB) and there is a rollback just after so nothing is donne.

If I uncomment the Transaction commands it works perfectly.

Where do come from this rollback ?


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.