Hi,

I have a server application running in karaf and I have problems to combine 
transactions defined in spring/camel and code having @Transactional annotation.

In my blueprint.xml I have defined something like this:

   <reference id="jtaTransactionManager" 
interface="javax.transaction.TransactionManager" />
   <reference id="userTransaction" 
interface="javax.transaction.UserTransaction" />

   <bean id="transactionManager" 
class="org.springframework.transaction.jta.JtaTransactionManager">
       <argument ref="jtaTransactionManager" />
       <argument ref="userTransaction" />
   </bean>

   <bean id="PROPAGATION_REQUIRES_NEW" 
class="org.apache.camel.spring.spi.SpringTransactionPolicy">
       <property name="transactionManager" ref="transactionManager" />
       <property name="propagationBehaviorName" 
value="PROPAGATION_REQUIRES_NEW" />
   </bean>

So I start a new transaction by using PROPAGATION_REQUIRES_NEW in a camel 
route. The camel route leads to a WebService endpoint. Anywhere in the 
underlying code where I use @Transactional and get a EntityManager injected I 
can see that the transaction is handled by a coordination from aries-jpa and 
gets committed by the uppermost @Transactional annotation.
But I want that the underlying code uses the transaction created by the 
PROPAGATION_REQUIRES_NEW in the camel route so I am maybe able to rollback the 
transaction inside the camel route. How to achieve this? Do I have to use a 
TransactionManager from aries-jpa instead?

Thanks in advance,
Christian

Reply via email to