[HHH-2778] TransactionManagerLookup implementation for Bitronix Transaction Manager
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@12932 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
379fe5f3d4
commit
c3f440cf48
|
@ -0,0 +1,34 @@
|
||||||
|
package org.hibernate.transaction;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.transaction.TransactionManager;
|
||||||
|
|
||||||
|
import org.hibernate.HibernateException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TransactionManager lookup strategy for BTM
|
||||||
|
* @author Ludovic Orban
|
||||||
|
*/
|
||||||
|
public class BTMTransactionManagerLookup implements TransactionManagerLookup {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.hibernate.transaction.TransactionManagerLookup#getTransactionManager(Properties)
|
||||||
|
*/
|
||||||
|
public TransactionManager getTransactionManager(Properties props) throws HibernateException {
|
||||||
|
try {
|
||||||
|
Class clazz = Class.forName("bitronix.tm.TransactionManagerServices");
|
||||||
|
return (TransactionManager) clazz.getMethod("getTransactionManager", null).invoke(null, null);
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
throw new HibernateException( "Could not obtain BTM transaction manager instance", e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.hibernate.transaction.TransactionManagerLookup#getUserTransactionName()
|
||||||
|
*/
|
||||||
|
public String getUserTransactionName() {
|
||||||
|
return "java:comp/UserTransaction";
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue