diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/Environment.java b/hibernate-core/src/main/java/org/hibernate/cfg/Environment.java index 685c4409f9..b8413c531c 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/Environment.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/Environment.java @@ -388,6 +388,11 @@ public final class Environment { * TransactionManagerLookup implementor to use for obtaining the TransactionManager */ public static final String TRANSACTION_MANAGER_STRATEGY = "hibernate.transaction.manager_lookup_class"; + /** + * If none is explicitly set, default TransactionManagerLookup implementor + * to use for obtaining the TransactionManager + */ + public static final String DEFAULT_TRANSACTION_MANAGER_STRATEGY = "hibernate.transaction.default_manager_lookup_class"; /** * JNDI name of JTA UserTransaction object */ diff --git a/hibernate-core/src/main/java/org/hibernate/transaction/TransactionManagerLookupFactory.java b/hibernate-core/src/main/java/org/hibernate/transaction/TransactionManagerLookupFactory.java index 11509cd508..29c8cae86b 100644 --- a/hibernate-core/src/main/java/org/hibernate/transaction/TransactionManagerLookupFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/transaction/TransactionManagerLookupFactory.java @@ -76,6 +76,9 @@ public final class TransactionManagerLookupFactory { */ public static TransactionManagerLookup getTransactionManagerLookup(Properties props) throws HibernateException { String tmLookupClass = props.getProperty( Environment.TRANSACTION_MANAGER_STRATEGY ); + if ( tmLookupClass == null ) { + tmLookupClass = props.getProperty( Environment.DEFAULT_TRANSACTION_MANAGER_STRATEGY ); + } if ( tmLookupClass == null ) { log.info( "No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)" ); return null;