Fabio Wang [
http://community.jboss.org/people/fabiowg] created the discussion
"Re: Drools, Spring integration and JTA in container"
To view the discussion, visit:
http://community.jboss.org/message/598937#598937
--------------------------------------------------------------
Hi there,
After some time struggling to make this "Spring + JTA + Drools" integration, I
could make it work, but I'm still unsure if it's the right way. As everyone
pointed out, the SingleSessionComand#initTransactionManager ignores the case where a
org.springframework.transaction.jta.JtaTransactionManager is used. So I had to manually
create an Environment like this:
Environment environment = EnvironmentFactory.newEnvironment();
environment.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
DroolsSpringTransactionManager jtaTransactionManager = new
DroolsSpringTransactionManager(ptm);
this.environment.set(EnvironmentName.TRANSACTION_MANAGER, jtaTransactionManager);
DroolsSpringJpaManager pcm = new DroolsSpringJpaManager(environment);
environment.set(EnvironmentName.PERSISTENCE_CONTEXT_MANAGER, pcm);
And, after that, I create my ksession (unfortunately, without the <drools:ksession/>
shortcut):
ksession = JPAKnowledgeService.newStatefulKnowledgeSession(this.kbase, null,
environment);
Hope this helps.
Fábio
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/598937#598937]
Start a new discussion in jBPM at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]