-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate Transaction, JTATransaction, UserTransaction
PostPosted: Wed Sep 27, 2006 12:33 am 
Regular
Regular

Joined: Wed Apr 12, 2006 12:49 am
Posts: 105
Location: Malaysia
Hi,

Hibernate version:
3.2.0 cr2.

Name and version of the database you are using:
mysql 5.0

1. What is the difference between the 3 type transactions?

2. If I specify the following in my hibernate.cfg.xml file, which means hibernate will not use direct jdbc connection, how come I don't get error if i use Hibernate Transaction for begin and commit? I thought we will need to use UserTransaction for begin and commit? Not necessary is it?

Code:
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>


3. Between, if i specify "org.hibernate.transaction.JTATransactionFactory" like in question 2, I find I can use jta or thread for the "current_session_context_class". Is this normal? Which one should I use?

Code:
<property name="hibernate.current_session_context_class">thread</property>


Thank you.

_________________
Thank you.

Regards,
Jap.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 27, 2006 1:25 am 
Beginner
Beginner

Joined: Tue Sep 26, 2006 11:46 pm
Posts: 33
Short answer, when using the JTATransaction factory hibernate will actually locate and begin the user transaction when you begin a hibernate transaction. If the user transaction is already in progress hibernate hooks in with it.

Have a look at the begin method of the JTATransaction http://fisheye.jboss.org/browse/~raw,r= ... ction.java

My understanding is that if you're always running in a JTA environment you can basically use Hibernate Transactions and User Transaction interchangeably.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 27, 2006 2:33 am 
Regular
Regular

Joined: Wed Apr 12, 2006 12:49 am
Posts: 105
Location: Malaysia
I see, thanks for the short explanation but it make sense to me. :)

How about "hibernate.current_session_context_class", should I put it as "thread" or "jta"? both does not give any error.

Thank you.

_________________
Thank you.

Regards,
Jap.


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