-->
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: Autocommit and Session/Transaction management
PostPosted: Fri Oct 12, 2007 3:29 am 
Newbie

Joined: Fri Sep 21, 2007 11:54 am
Posts: 9
Location: Switzerland
After many reading (http://hibernate.org/42.html and "Java Persistence book", chap. 10.3 and 16), I didn't found any answer to my question...

I know that autcommit isn't a great solution but I would like to try it on my readonly DB. The main goal is to avoid the "manual management" of Session and Transaction. So I'm wondering if using the following code, Transaction and Session are automatically closed when autocommit is set to on:

Code:
Session session = hibConnection.getSessionFactory().getCurrentSession();
session.beginTransaction();
MyDAO daoObj = session.createCriteria(myClass.class)
                     .add(Restrictions.between("createTime", start, end))
                     .list();


In this code, I never end the current Transaction and Session, and I don't know if the autocommit is doing it for me, and when ?

I know that Tx management should be done arround the service management in a Middleware (3-tier) application but I would like to try the autocommit way too..


Many thanks in advance !

Joël


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.