Search in sources :

Example 1 with JtaPlatformException

use of org.hibernate.engine.transaction.jta.platform.spi.JtaPlatformException in project hibernate-orm by hibernate.

the class BitronixJtaPlatform method locateTransactionManager.

@Override
protected TransactionManager locateTransactionManager() {
    try {
        Class transactionManagerServicesClass = serviceRegistry().getService(ClassLoaderService.class).classForName(TM_CLASS_NAME);
        final Method getTransactionManagerMethod = transactionManagerServicesClass.getMethod("getTransactionManager");
        return (TransactionManager) getTransactionManagerMethod.invoke(null);
    } catch (Exception e) {
        throw new JtaPlatformException("Could not locate Bitronix TransactionManager", e);
    }
}
Also used : TransactionManager(javax.transaction.TransactionManager) Method(java.lang.reflect.Method) JtaPlatformException(org.hibernate.engine.transaction.jta.platform.spi.JtaPlatformException) JtaPlatformException(org.hibernate.engine.transaction.jta.platform.spi.JtaPlatformException) ClassLoaderService(org.hibernate.boot.registry.classloading.spi.ClassLoaderService)

Example 2 with JtaPlatformException

use of org.hibernate.engine.transaction.jta.platform.spi.JtaPlatformException in project hibernate-orm by hibernate.

the class JOTMJtaPlatform method locateTransactionManager.

@Override
protected TransactionManager locateTransactionManager() {
    try {
        final Class tmClass = serviceRegistry().getService(ClassLoaderService.class).classForName(TM_CLASS_NAME);
        final Method getTransactionManagerMethod = tmClass.getMethod("getTransactionManager");
        return (TransactionManager) getTransactionManagerMethod.invoke(null, (Object[]) null);
    } catch (Exception e) {
        throw new JtaPlatformException("Could not obtain JOTM transaction manager instance", e);
    }
}
Also used : TransactionManager(javax.transaction.TransactionManager) Method(java.lang.reflect.Method) JtaPlatformException(org.hibernate.engine.transaction.jta.platform.spi.JtaPlatformException) JtaPlatformException(org.hibernate.engine.transaction.jta.platform.spi.JtaPlatformException) ClassLoaderService(org.hibernate.boot.registry.classloading.spi.ClassLoaderService)

Example 3 with JtaPlatformException

use of org.hibernate.engine.transaction.jta.platform.spi.JtaPlatformException in project hibernate-orm by hibernate.

the class JOnASJtaPlatform method locateTransactionManager.

@Override
protected TransactionManager locateTransactionManager() {
    try {
        final Class clazz = Class.forName(TM_CLASS_NAME);
        final Method getTransactionManagerMethod = clazz.getMethod("getTransactionManager");
        return (TransactionManager) getTransactionManagerMethod.invoke(null);
    } catch (Exception e) {
        throw new JtaPlatformException("Could not obtain JOnAS transaction manager instance", e);
    }
}
Also used : TransactionManager(javax.transaction.TransactionManager) Method(java.lang.reflect.Method) JtaPlatformException(org.hibernate.engine.transaction.jta.platform.spi.JtaPlatformException) JtaPlatformException(org.hibernate.engine.transaction.jta.platform.spi.JtaPlatformException)

Aggregations

Method (java.lang.reflect.Method)3 TransactionManager (javax.transaction.TransactionManager)3 JtaPlatformException (org.hibernate.engine.transaction.jta.platform.spi.JtaPlatformException)3 ClassLoaderService (org.hibernate.boot.registry.classloading.spi.ClassLoaderService)2