use of org.wildfly.extension.picketlink.idm.jpa.transaction.TransactionalEntityManagerHelper in project wildfly by wildfly.
the class JPAIdentityStoreService method start.
@Override
public void start(StartContext startContext) throws StartException {
this.storeConfig = this.configurationBuilder.create();
this.transactionalEntityManagerHelper = new TransactionalEntityManagerHelper(this.transactionSynchronizationRegistry.getValue(), this.transactionManager.getValue());
try {
configureEntityManagerFactory();
configureEntities();
} catch (Exception e) {
throw ROOT_LOGGER.idmJpaStartFailed(e);
}
this.configurationBuilder.addContextInitializer(new ContextInitializer() {
@Override
public void initContextForStore(IdentityContext context, IdentityStore<?> store) {
if (store instanceof JPAIdentityStore) {
EntityManager entityManager = context.getParameter(JPAIdentityStore.INVOCATION_CTX_ENTITY_MANAGER);
if (entityManager == null || !entityManager.isOpen()) {
context.setParameter(JPAIdentityStore.INVOCATION_CTX_ENTITY_MANAGER, getEntityManager(getTransactionManager().getValue()));
}
}
}
});
}
Aggregations