-->
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.  [ 2 posts ] 
Author Message
 Post subject: Transaction Commit probleme
PostPosted: Fri Jan 29, 2010 4:07 am 
Newbie

Joined: Wed Jan 13, 2010 10:28 am
Posts: 4
Hi,

in some cases, not always, i got transaction probleme:
my transaction commit, with no errors but the data is not saved in the DB

any idea of point to follow?
it works in 99% in my app but in some case not and i got any errors

what i do :i start my tx :
Code:
SessionManager.currentSession().beginTransaction();


do my work...
save my tx
Code:
s.saveOrUpdate(object);
         s.flush();

then commit

Code:
session = SessionManager.currentSession();
         session.getTransaction().commit();
         session.flush();


Top
 Profile  
 
 Post subject: Re: Transaction Commit probleme
PostPosted: Mon Feb 01, 2010 3:56 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
I your situation the first thing I would try, is to call SessionManager.currentSession()
only once per transaction. In this way you work with 100% sureness the correct session:


Code:
mysession = SessionManager.currentSession();

mysession.beginTransaction();

mysession.saveOrUpdate(object);
mysession.flush();
mysession.getTransaction().commit();


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

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.