-->
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: Query about Hibernate Transaction Semantics
PostPosted: Mon Mar 31, 2008 10:18 am 
Newbie

Joined: Mon Feb 18, 2008 9:45 am
Posts: 4
Location: Blore
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:3.2.4.sp1

Code between sessionFactory.openSession() and session.close():[session.beginTransaction().begin(); ...
...
...session.beginTransaction().commit();
}catch(HibernateException hex){
hex.printStackTrace();
session.beginTransaction().rollback();
}finally{
if(session!=null){
HibernateUtil.releaseSession(session);
}/b]

[b]Name and version of the database you are using:SQL Server 2005



Problems with Session and transaction handling? Yes

Hi,
Im a newbie at using hibernate and wanted clarification for the following:
Can we use session.beginTransaction().commit() and session.beginTransaction().rollback() or do we need to do the following
Transaction tx = session.getTransaction();
tx.begin(); ....
....
tx.commit();
catch(Exception e){
tx.rollback();
}

Pls let me know whether it is legal & correct to use session.beginTransaction().commit() / rollback() as it seems to work without any exceptions.

thanks in advance.

_________________
Regards,
Shreyas


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.