List of usage examples for org.hibernate.engine.transaction.jta.platform.internal JBossAppServerJtaPlatform JBossAppServerJtaPlatform
JBossAppServerJtaPlatform
From source file:org.wildfly.extension.picketlink.idm.service.JPAIdentityStoreService.java
License:Open Source License
private EntityManagerFactory createEmbeddedEntityManagerFactory() { ROOT_LOGGER.debugf("Creating embedded EntityManagerFactory."); ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader(); try {/*from ww w . j ava 2 s. co m*/ 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); } }