use of org.hibernate.engine.transaction.jta.platform.internal.JBossAppServerJtaPlatform in project wildfly by wildfly.
the class JPAIdentityStoreService method createEmbeddedEntityManagerFactory.
private EntityManagerFactory createEmbeddedEntityManagerFactory() {
ROOT_LOGGER.debugf("Creating embedded EntityManagerFactory.");
ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
try {
Map<Object, Object> properties = new HashMap<Object, Object>();
String dataSourceJndiUrl = this.storeConfig.getDataSourceJndiUrl();
if (!isNullOrEmpty(dataSourceJndiUrl)) {
ROOT_LOGGER.debugf("Using datasource [%s] for embedded EntityManagerFactory.", dataSourceJndiUrl);
properties.put("javax.persistence.jtaDataSource", dataSourceJndiUrl);
}
properties.put(AvailableSettings.JTA_PLATFORM, new JBossAppServerJtaPlatform());
Module entityModule = this.storeConfig.getEntityModule();
if (entityModule != null) {
Thread.currentThread().setContextClassLoader(entityModule.getClassLoader());
}
return Persistence.createEntityManagerFactory(this.storeConfig.getEntityModuleUnitName(), properties);
} finally {
Thread.currentThread().setContextClassLoader(originalClassLoader);
}
}
Aggregations