-->
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.  [ 2 posts ] 
Author Message
 Post subject: CMTTransactionFactory or JTATransactionFactory?
PostPosted: Tue Apr 15, 2008 6:23 am 
Newbie

Joined: Tue Apr 15, 2008 5:53 am
Posts: 1
Hello, guys.

We have a web application Ejb 2.1 / Hibernate.
Before all our transactions were managed by a Container (CMT).

Thus in our hibernate.properties file we specified CMTTransactionFactory.
hibernate.transaction.factory_class=org.hibernate.transaction.CMTTransactionFactory

Recently we required in one BMT usage (bean, where transactions are managed by Transaction API (UserTransaction interface)).

We wonder if we should switch our configuration in hibernate.properties to
hibernate.transaction.factory_class=org.hibernate.transaction.JTATransactionFactory

In manuals and books there are written:
"The CMTTransactionFactory
should be enabled if you’re working with JTA and EJBs, and if you plan to set transaction
boundaries declaratively on your managed EJB components—in other
words, if you deploy your EJB application on a Java EE application server but don’t
set transaction boundaries programmatically with the UserTransaction interface
in application code." (c) Hibernate in Action

But in EJBContext there is getUserTransaction() method. And it works fine with specified CMTTransactionFactory. What possible issues we can get using CMTTransactionFactory together with explicitly usage of Transaction API (getUserTransaction()).

Should we switch our configuration to JTATransactionFactory"?
If thus, will we loose in performance in comparing with CMTTransactionFactory?

Guys, could you provide detail answer?

Many thanks.


Top
 Profile  
 
 Post subject: Re: CMTTransactionFactory or JTATransactionFactory?
PostPosted: Tue Apr 15, 2008 10:58 am 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
Not necessarily but you should always make sure in that bean there is an active transaction before any call to hibernate api.



Farzad-


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