-->
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.  [ 5 posts ] 
Author Message
 Post subject: Session, Transaction and Custom Connection
PostPosted: Sat Oct 01, 2005 1:19 am 
Regular
Regular

Joined: Thu Feb 17, 2005 1:58 am
Posts: 63
My code obtains Connection c on its own. A Session s is opened with the Connection c.

Then, s.save(object1);s.save(object2);....s.close()....c.commit();

Against mysql, it looks like the entire "transaction" got rolled back.

The doc says, Transaction tx = s.beginTransaction .... t.commit(); s.close(), so I figure my approach is totally wacked right?

But well, what if I wanted to do something custom to the connection c and I needed to do that in a different scope than Session s?

In other words, I want to get a Session s with a custom Connection c, use s to persist a few objects, close s, then continue to work using c, then c.commit...that would not work right?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 01, 2005 12:54 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
databse have to support rollback savepoint - I don't know for mysql, but postgresql, oracle support it


Top
 Profile  
 
 Post subject: mysql support of tx
PostPosted: Sat Oct 01, 2005 1:35 pm 
Newbie

Joined: Wed Aug 31, 2005 4:32 pm
Posts: 13
mysql supports transactions, foreign keys, cascaded operations starting with 3.23.x and savepoints starting with 4.x. Of course you have to use InnoBD table engine


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 01, 2005 5:49 pm 
Regular
Regular

Joined: Thu Feb 17, 2005 1:58 am
Posts: 63
Well, yes, I use InnoDB. So it looks like I need to invoke save points somehow before I close the hibernate session?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 01, 2005 6:02 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
I search hibernate and I think that hibernate doesn' support savepoint yet, but it is planned (Gavin's post - search forum)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.