-->
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: Some confusion when using jta
PostPosted: Thu May 10, 2007 3:10 am 
Newbie

Joined: Sun Jan 29, 2006 1:54 am
Posts: 1
I used EJB3.0 to manage transaction over hibernate, I config the following ptoperties in config file,

<property name="hibernate.transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.SunONETransactionManagerLookup</property>

1) I know hibernate uses hibernate.transaction.manager_lookup_class to locate transaction manager in application server, my explanation of what hibernate does is hibernate uses transaction manager to locate a stated transaction in the context(maybe in the local thread) and synchronize hibernate transaction operation to that transaction, is it right?


2) If I use jta to manage transaction, code may look like this:

UserTransaction tx = (UserTransaction) (new InitialContext()).lookup("java:comp/UserTransaction");
tx.begin();
Session session = HibernateUtil.openSession();
....
session.flush();
session.close();
tx.commit();

The code runs fine, but how can a transaction rollback after connection has been closed( session.close(); )?


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.