Bira Neto [
https://community.jboss.org/people/biraneto] created the discussion
"Re: Null cmdScopedEntityManager during stateful session load"
To view the discussion, visit:
https://community.jboss.org/message/745146#745146
--------------------------------------------------------------
Unfortunately, not passing the transaction is not a good option for me as I don't want
to use and have to setup jndi on a specific server (I want to abstract this issues)
What solved for me was to bypass the current JpaProcessPersistenceContextManager
implementation (which may still have a bug... I would make some tests).
I changed my environment initialization to
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
env.set(EnvironmentName.TRANSACTION, ut);
env.set(EnvironmentName.TRANSACTION_MANAGER, new
JtaTransactionManager( ut,
env.get( EnvironmentName.TRANSACTION_SYNCHRONIZATION_REGISTRY ),
TransactionManagerServices.getTransactionManager() ));
env.set(EnvironmentName.PERSISTENCE_CONTEXT_MANAGER, new
JPAProcessPersistenceContextManagerPk(env));
On my JPAProcessPersistenceContextManagerPk (extends JpaProcessPersistenceContextManager)
I overrided the current getProcessPersistenceContext to the implementation below
public ProcessPersistenceContext getProcessPersistenceContext() {
if (cmdScopedEntityManager == null) {
this.beginCommandScopedEntityManager();
}
return new JpaProcessPersistenceContext( cmdScopedEntityManager );
}
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/745146#745146]
Start a new discussion in jBPM at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]