[ 
https://issues.apache.org/jira/browse/CAMEL-7269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hristo Sabev reopened CAMEL-7269:
---------------------------------

    Estimated Complexity: Advanced  (was: Unknown)

Hi,

Just tested the fix. Now the call to joinTransaction is ommited, however 
there's a later call to EntityManager.flush(), which also requires a 
transaction. This call is at JpaConsumer:137

To my understanding the problem is a bit more generic and the fix to ommit the 
joinTransaction call is not enough. What is visible from the code is that the 
polling is done inside a TransactionTemplate with TransactionRequired behavior. 
This is seen at JpaEndpoint:280, where the method createTransactionTemplate is 
overriden and that is called at JpaConsumer:82 to create the transaction 
template. Now the problem is that a TransactionStatus which says that there's a 
new transaction is obtained from the TransactionManager at 
TransactionTemplate:128, no call to EntityManager.getTransaction().begin() is 
ever made. This leaves the entity transaction with no real jdbc transaction and 
the later call to EntityManager.flush just fails.

An alternative would be to ommit the call to flush() and execute the call 
withouth any transaction similarly to how call is ommited for joinTransaction. 
However this more or less mangles the semantics of the transaction template 
with "required" behavior



> camel-jpa - joinTransaction called for RESOURCE_LOCAL datasource
> ----------------------------------------------------------------
>
>                 Key: CAMEL-7269
>                 URL: https://issues.apache.org/jira/browse/CAMEL-7269
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jpa
>    Affects Versions: 2.12.0
>         Environment: tomcat+eclipselink+camel 2.12.2
>            Reporter: Hristo Sabev
>            Assignee: Claus Ibsen
>             Fix For: 2.12.4, 2.13.0
>
>
> At line 82, JpaConsumer calls entityManager.joinTransaction(). This call 
> cannot really work in environmnent without JTA. This is a change since 2.11.x 
> and earlier versions where non JTA environments were supported



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to