[jboss-user] [jBPM] - Re: Drools, Spring integration and JTA in container

Fabio Wang do-not-reply at jboss.com
Fri Apr 8 15:09:37 EDT 2011


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&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110408/e1231b39/attachment-0001.html 


More information about the jboss-user mailing list