Search in sources :

Example 1 with GenericTransactionManagerLookup

use of org.infinispan.transaction.lookup.GenericTransactionManagerLookup in project hibernate-orm by hibernate.

the class InfinispanRegionFactory method configureTransactionManager.

private void configureTransactionManager(ConfigurationBuilder builder) {
    TransactionConfiguration transaction = builder.transaction().create();
    if (transaction.transactionMode().isTransactional()) {
        final String ispnTmLookupClassName = transaction.transactionManagerLookup().getClass().getName();
        final String hbTmLookupClassName = org.hibernate.cache.infinispan.tm.HibernateTransactionManagerLookup.class.getName();
        if (GenericTransactionManagerLookup.class.getName().equals(ispnTmLookupClassName)) {
            log.debug("Using default Infinispan transaction manager lookup " + "instance (GenericTransactionManagerLookup), overriding it " + "with Hibernate transaction manager lookup");
            builder.transaction().transactionManagerLookup(transactionManagerlookup);
        } else if (ispnTmLookupClassName != null && !ispnTmLookupClassName.equals(hbTmLookupClassName)) {
            log.debug("Infinispan is configured [" + ispnTmLookupClassName + "] with a different transaction manager lookup " + "class than Hibernate [" + hbTmLookupClassName + "]");
        } else {
            // Infinispan TM lookup class null, so apply Hibernate one directly
            builder.transaction().transactionManagerLookup(transactionManagerlookup);
        }
        builder.transaction().useSynchronization(DEF_USE_SYNCHRONIZATION);
    }
}
Also used : TransactionConfiguration(org.infinispan.configuration.cache.TransactionConfiguration) GenericTransactionManagerLookup(org.infinispan.transaction.lookup.GenericTransactionManagerLookup)

Aggregations

TransactionConfiguration (org.infinispan.configuration.cache.TransactionConfiguration)1 GenericTransactionManagerLookup (org.infinispan.transaction.lookup.GenericTransactionManagerLookup)1