camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Babak Vahdat <babak.vah...@swissonline.ch>
Subject Re: Problem with Camel Jpa Component and Container Managed Transaction
Date Fri, 22 Jun 2012 14:31:11 GMT
Hi

The problem you're facing is pretty obvious: Looking at your persistence.xml
you do ask for a "Container managed global transaction", as you have defined
the transaction type to be "JTA", as well you've defined a
JTA-enabled-Datasource for it. BUT you make use of spring
JpaTransactionManager which doesn't match to this requirment (provides only
local transactions for one single resource)! Look at the source of
JpaTransactionManager to see how it manages the transactions
(commit/rollback). And this's exactly why OpenJPA barks on your box :-)

So to be consistent either make use of spring JtaTransactionManager instead
of JpaTransactionManager (providing global transaction demarcation), but
then there should be a JTA-TM running inside your container (e.g. Arjuna,
Atomikos, etc.) talking to spring JtaTransactionManager.

The other option could be to stick to "local transactions", that's:

<persistence-unit name="pdsprint1" transaction-type="RESOURCE_LOCAL">

And removing the JTA-Datasource inside persistence.xml.

Looking at your Camel route I would go for the second option as database is
the *only* transactional resource you have, e.g. you don't need any
orchestration between a JPA-Resource together with a JMS-Resource.

Babak 


--
View this message in context: http://camel.465427.n5.nabble.com/Problem-with-Camel-Jpa-Component-and-Container-Managed-Transaction-tp5714815p5714928.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message