Java 类org.hibernate.service.jta.platform.spi.JtaPlatform 实例源码

项目:class-guard    文件:SpringSessionContext.java   
/**
 * Create a new SpringSessionContext for the given Hibernate SessionFactory.
 * @param sessionFactory the SessionFactory to provide current Sessions for
 */
public SpringSessionContext(SessionFactoryImplementor sessionFactory) {
    this.sessionFactory = sessionFactory;
    JtaPlatform jtaPlatform = sessionFactory.getServiceRegistry().getService(JtaPlatform.class);
    TransactionManager transactionManager = jtaPlatform.retrieveTransactionManager();
    this.jtaSessionContext = (transactionManager != null ? new SpringJtaSessionContext(sessionFactory) : null);
}
项目:hibernate-dynamic-dialects    文件:SessionFactoryImpl.java   
private boolean canAccessTransactionManager() {
    try {
        return serviceRegistry.getService(JtaPlatform.class)
                .retrieveTransactionManager() != null;
    } catch (Exception e) {
        return false;
    }
}
项目:debop4j    文件:JpaTestBase.java   
/** Get JBoss TM out of Hibernate */
public static TransactionManager extractJBossTransactionManager(EntityManagerFactory factory) {
    if (log.isDebugEnabled())
        log.debug("TransactionManager를 꺼냅니다.");
    SessionFactoryImplementor sessionFactory =
            (SessionFactoryImplementor) ((HibernateEntityManagerFactory) factory).getSessionFactory();
    return sessionFactory.getServiceRegistry().getService(JtaPlatform.class).retrieveTransactionManager();
}
项目:ignite    文件:HibernateL2CacheTransactionalSelfTest.java   
/** {@inheritDoc} */
@Nullable @Override protected ServiceRegistryBuilder registryBuilder() {
    ServiceRegistryBuilder builder = new ServiceRegistryBuilder();

    DatasourceConnectionProviderImpl connProvider = new DatasourceConnectionProviderImpl();

    BasicManagedDataSource dataSrc = new BasicManagedDataSource(); // JTA-aware data source.

    dataSrc.setTransactionManager(jotm.getTransactionManager());

    dataSrc.setDefaultAutoCommit(false);

    JdbcDataSource h2DataSrc = new JdbcDataSource();

    h2DataSrc.setURL(CONNECTION_URL);

    dataSrc.setXaDataSourceInstance(h2DataSrc);

    connProvider.setDataSource(dataSrc);

    connProvider.configure(Collections.emptyMap());

    builder.addService(ConnectionProvider.class, connProvider);

    builder.addService(JtaPlatform.class, new TestJtaPlatform());

    builder.addService(TransactionFactory.class, new JtaTransactionFactory());

    return builder;
}