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");
}