-->
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.  [ 19 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: Wed Apr 12, 2006 3:20 pm 
Expert
Expert

Joined: Thu Sep 22, 2005 10:29 am
Posts: 285
Location: Almassera/Valencia/Spain/EU/Earth/Solar system/Milky Way/Local Group/Virgo Supercluster
try something like
Code:
Session session = getSessionInSomeWay(...);
try{
   Transaction tx = session.beginTransaction();
   session.saveOrUpdate(actionForm);
   tx.commit();
} catch(Exception e) {
   if(tx != null) {
      tx.rollback();
   }
   throw new Exception(e);
} finally {
   session.close();
}



Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 12, 2006 3:33 pm 
Newbie

Joined: Tue Apr 11, 2006 4:20 pm
Posts: 14
pepelnm wrote:
try something like
Code:
Session session = getSessionInSomeWay(...);
try{
   Transaction tx = session.beginTransaction();
   session.saveOrUpdate(actionForm);
   tx.commit();
} catch(Exception e) {
   if(tx != null) {
      tx.rollback();
   }
   throw new Exception(e);
} finally {
   session.close();
}



no dice... the sql statement looks like this:

Code:
insert into change_request(title, description, date) values (?, ?, ?)


actually, after doing a select * from change_request, I see the 1 entry. it seems to have worked but the sql is showing question marks.

_________________
Cheers,
Ken


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 12, 2006 3:38 pm 
Expert
Expert

Joined: Thu Sep 22, 2005 10:29 am
Posts: 285
Location: Almassera/Valencia/Spain/EU/Earth/Solar system/Milky Way/Local Group/Virgo Supercluster
so, what's the problem?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 12, 2006 3:44 pm 
Newbie

Joined: Tue Apr 11, 2006 4:20 pm
Posts: 14
None, even though the sql statement shows question marks for the values, the entries in the database are correct. Implementing the transaction worked. Thanks for the help. I gave you credit btw.

_________________
Cheers,
Ken


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

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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.