-->
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: Validate a session
PostPosted: Thu Nov 01, 2007 6:46 am 
Newbie

Joined: Thu Nov 01, 2007 6:34 am
Posts: 2
Hi, im doing transaction management, my code looks something like this


SessionFactory fact = getSessionFactory();
sess = fact.openSession();
tr = sess.beginTransaction();
MTSUserImpl user = (MTSUserImpl) sess.get(MTSUserImpl.class, new String("Marc"));
sess.setLocation("Boston");
sess.update(user);

MTSUserImpl user1 = new MTSUserImpl();
user1.setUserID("andy");
user1.setOperatorID("aa");
user1.setLocation("NYC");
sess.save(user1);

tr.commit();
sess.close();

Now my problem is that its only at tr.commit() when i get to know if the session is valid, in the sense that the insert and update queries will work fine or not. Is there a way whereby i can find out if the session saves and updates are valid or not before commiting the transaction?


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.