[rules-users] JPA process working in container?

Kris Verlaenen kris.verlaenen at cs.kuleuven.be
Mon Aug 17 09:45:19 EDT 2009


Hi garrett,

If there are issues with persistence in a specific setting, we will try
to help you as much as possible.  Any improvements are more than
welcome.  Comments inline below.

Quoting Garrett Conaty <garrett at conaty.net>:
> Specifically:  In SingleSessionCommandService
> 
> a) the constructor starts a new UserTransaction regardless if one is 
> already active.  Using Bitronix TM or some other that doesn't support
> nested transactions causes this to fail

True, we expected the session to be set up before-hand, so
user-transactions would only be used when executing commands.  But I
agree that we could just as well use the user transaction if one is
available there.  I managed to reproduce the issue and will fix this on
trunk asap.

> b) The use of 'this.em' as the entity manager across calls to  
> 'execute(GenericCommand<t> command) doesn't work with JTA and  
> Hibernate.  Specifically the Hibernate session is closed when the JTA
> transaction commits.  Therefore, this.em cannot be reused

Could you reproduce this issue for me? We are also using hibernate in
our tests, and there are some tests for user transactions that seem to
reuse the same em accross commits:
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-persistence-jpa/src/test/java/org/drools/persistence/session/PersistentStatefulSessionTest.java
So we must be missing something. If you could add a failing test to that
one, I'd be more than happy to take a look.

> c) this.localEm is never used
The local em is bound to the environment, and other components that need
access to an em can then access this local em through the environment.

Thx,
Kris


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm



More information about the rules-users mailing list