Search in sources :

Example 6 with JtaPlatform

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

the class SingleNodeTest method afterSessionFactoryBuilt.

@Override
protected void afterSessionFactoryBuilt(SessionFactoryImplementor sessionFactory) {
    super.afterSessionFactoryBuilt(sessionFactory);
    JtaPlatform jtaPlatform = sessionFactory().getServiceRegistry().getService(JtaPlatform.class);
    if (jtaPlatformClass != null) {
        assertNotNull(jtaPlatform);
        assertEquals(jtaPlatformClass, jtaPlatform.getClass());
    }
}
Also used : JtaPlatform(org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform)

Example 7 with JtaPlatform

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

the class SingleNodeTest method withTxSession.

protected void withTxSession(SessionBuilder sessionBuilder, TxUtil.ThrowingConsumer<Session, Exception> consumer) throws Exception {
    JtaPlatform jtaPlatform = useJta ? sessionFactory().getServiceRegistry().getService(JtaPlatform.class) : null;
    TxUtil.withTxSession(jtaPlatform, sessionBuilder, consumer);
}
Also used : JtaPlatform(org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform)

Example 8 with JtaPlatform

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

the class JtaPlatformInitiator method initiateService.

@Override
@SuppressWarnings({ "unchecked" })
public JtaPlatform initiateService(Map configurationValues, ServiceRegistryImplementor registry) {
    final Object setting = configurationValues.get(AvailableSettings.JTA_PLATFORM);
    final JtaPlatform platform = registry.getService(StrategySelector.class).resolveStrategy(JtaPlatform.class, setting);
    if (platform == null) {
        LOG.debugf("No JtaPlatform was specified, checking resolver");
        return registry.getService(JtaPlatformResolver.class).resolveJtaPlatform(configurationValues, registry);
    }
    return platform;
}
Also used : JtaPlatformResolver(org.hibernate.engine.transaction.jta.platform.spi.JtaPlatformResolver) JtaPlatform(org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform) StrategySelector(org.hibernate.boot.registry.selector.spi.StrategySelector)

Aggregations

JtaPlatform (org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform)8 TransactionManager (javax.transaction.TransactionManager)3 Session (org.hibernate.Session)2 SystemException (javax.transaction.SystemException)1 Transaction (javax.transaction.Transaction)1 HibernateException (org.hibernate.HibernateException)1 Transaction (org.hibernate.Transaction)1 ClassLoaderService (org.hibernate.boot.registry.classloading.spi.ClassLoaderService)1 ClassLoadingException (org.hibernate.boot.registry.classloading.spi.ClassLoadingException)1 StrategySelector (org.hibernate.boot.registry.selector.spi.StrategySelector)1 JtaPlatformProvider (org.hibernate.engine.transaction.jta.platform.spi.JtaPlatformProvider)1 JtaPlatformResolver (org.hibernate.engine.transaction.jta.platform.spi.JtaPlatformResolver)1 BatchModeJtaPlatform (org.hibernate.test.cache.infinispan.util.BatchModeJtaPlatform)1