You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Christian Schneider <ch...@die-schneider.net> on 2014/11/05 16:23:08 UTC

Calling a camel route seems to commit an outside transaction

I have an application running in OSGi that uses aries blueprint and 
aries jpa.

My class A is marked as transactional in blueprint and uses an XA 
transaction.
Inside such a transactional method from class A I
- first create a persistent entity in the DB
- then call a camel route using producer.requestBodyAndHeaders
- then I do some other changes on the entity

After the method I expect aries to commit the transaction.

The problem is that camel seems to already commit the transaction at the 
end of the route processing. I have not done any special transactional 
settings on the camel route.

Any idea why this happens and how I could avoid it?

Christian

-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com


Re: Calling a camel route seems to commit an outside transaction

Posted by Christian Schneider <ch...@die-schneider.net>.
Hi Preben,

yes. There is indeed an option. By default it is set to auto which seems 
to cause the commit.

The problem is that we need the uncommitted data to do the query. 
Interestingly outside of OSGi in spring it seems to behave differently.
There the data seems to go to the first level cache and is available for 
the query but not committed. So if anyone knows why it is different that 
would help us a lot.

Christian

Am 06.11.2014 17:45, schrieb Preben.Asmussen:
> I have seen that before in the old ejb days.
>
> The trick is to tell the persistent provider not to do commit before query.
> I would guess that Hibernate has a option to turn commit before query off.
>
> Preben
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Calling-a-camel-route-seems-to-commit-an-outside-transaction-tp5758545p5758617.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


-- 
  
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com


Re: Calling a camel route seems to commit an outside transaction

Posted by "Preben.Asmussen" <pr...@dr.dk>.
I have seen that before in the old ejb days.

The trick is to tell the persistent provider not to do commit before query.
I would guess that Hibernate has a option to turn commit before query off.

Preben



--
View this message in context: http://camel.465427.n5.nabble.com/Calling-a-camel-route-seems-to-commit-an-outside-transaction-tp5758545p5758617.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Calling a camel route seems to commit an outside transaction

Posted by Christian Schneider <ch...@die-schneider.net>.
Seems our analysis was wrong. Camel is not involved in the problem after 
all.

It seems to be a problem with hibnernate doing a commit before a 
criteria based lookup.

Christian


On 05.11.2014 16:23, Christian Schneider wrote:
> I have an application running in OSGi that uses aries blueprint and 
> aries jpa.
>
> My class A is marked as transactional in blueprint and uses an XA 
> transaction.
> Inside such a transactional method from class A I
> - first create a persistent entity in the DB
> - then call a camel route using producer.requestBodyAndHeaders
> - then I do some other changes on the entity
>
> After the method I expect aries to commit the transaction.
>
> The problem is that camel seems to already commit the transaction at 
> the end of the route processing. I have not done any special 
> transactional settings on the camel route.
>
> Any idea why this happens and how I could avoid it?
>
> Christian
>


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com