-->
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: EJB3Configuration and txStrategy
PostPosted: Mon Apr 03, 2006 6:34 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
If you set your transaction strategy
Code:
            <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.CMTTransactionFactory"/>

you always get an exception ... since 'else' is executed.

Code:
      boolean hasTxStrategy = StringHelper.isNotEmpty( preparedProperties.getProperty( Environment.TRANSACTION_STRATEGY ) );
      if (! hasTxStrategy && transactionType == PersistenceUnitTransactionType.JTA) {
         preparedProperties.setProperty( Environment.TRANSACTION_STRATEGY, JoinableCMTTransactionFactory.class.getName() );
      }
      else if (! hasTxStrategy && transactionType == PersistenceUnitTransactionType.RESOURCE_LOCAL) {
         preparedProperties.setProperty( Environment.TRANSACTION_STRATEGY, JDBCTransactionFactory.class.getName() );
      }
      else {
         new AssertionFailure("Unknown PersisntenceUnitTransactionType: " + transactionType);
      }
      if (hasTxStrategy) {
         log.warn("Overriding " + Environment.TRANSACTION_STRATEGY + " is dangerous, this might break the EJB3 specification implementation");
      }

_________________
--------------------------------
Ales Justin
JBoss, a division of Red Hat


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 03, 2006 1:02 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Fixed, but still this is a real bad idea to define the transaction strategy manually. You will not comply with the spec.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 04, 2006 3:02 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
Great.
And thanx for the tip.

ps: txStartegy removed as it was almost similar as now by default - CMT

_________________
--------------------------------
Ales Justin
JBoss, a division of Red Hat


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.