[rules-users] Drools Spring + JPA + JTA

Cristiano Nicolai cristiano.nicolai at gmail.com
Sun Dec 5 21:09:21 EST 2010


Hi guys,

I'm trying to deploy a spring based Knowledege Session with JPA persistence
on Jboss 5.1, I was able to do it using a RESOURCE_LOCAL persistence unit
but I would like to use a container JTA based deployment.

Basically, JPAConfiguration requires a Spring PlatformTransactionManager
then I tried to use the following combination:

<bean id="springTxManager"
class="org.springframework.transaction.jta.JtaTransactionManager" />
<jee:jndi-lookup id="springEMF" jndi-name="java:DroolsEMF"/>

The problem is that using it,
SingleSessionCommandService.initTransactionManager does not create a
JPAManager.

So, my guess for this to work is to add support for this on
SingleSessionCommandService or change JPAConfiguration
(drools-spring-1.0.0.xsd) to accept that no transaction-manager is defined,
causing Drools JtaTransactionManager to lookup the TransactionMananger from
JNDI context.

The only way that I could deploy it is using these beans definitions:

<bean id="springEMF"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="persistenceXmlLocation"
value="classpath:META-INF/spring-persistence.xml" />
        <property name="jpaVendorAdapter">
            <bean
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />
        </property>
    </bean>

    <bean id="springTxManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
           <property name="entityManagerFactory" ref="springEMF" />
    </bean>


Thanks.


-- 
Best regards,

Cristiano Nicolai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20101206/3296bf32/attachment.html 


More information about the rules-users mailing list