HHH-6170 Offer ability to customize the default TransactionManagerLookup implementation
This commit is contained in:
parent
45ac70b03d
commit
2706b688f2
|
@ -388,6 +388,11 @@ public final class Environment {
|
|||
* <tt>TransactionManagerLookup</tt> implementor to use for obtaining the <tt>TransactionManager</tt>
|
||||
*/
|
||||
public static final String TRANSACTION_MANAGER_STRATEGY = "hibernate.transaction.manager_lookup_class";
|
||||
/**
|
||||
* If none is explicitly set, default <tt>TransactionManagerLookup</tt> implementor
|
||||
* to use for obtaining the <tt>TransactionManager</tt>
|
||||
*/
|
||||
public static final String DEFAULT_TRANSACTION_MANAGER_STRATEGY = "hibernate.transaction.default_manager_lookup_class";
|
||||
/**
|
||||
* JNDI name of JTA <tt>UserTransaction</tt> object
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue