Nils Renaud
Nils Renaud

Reputation: 584

Camel JPA @Consumed alternatives

My main question is : Is there any alternative to @Consumed annotation on a method inside the JPA entity class ?

I ask this question because I really want to externalize my JPA model (eg. all my entities) to be able to share among onther projects using the same database. Also I don't want some Camel dependancies in my sub-project that implies to delete the @Consumed annotation. I basically have a route like this :

from("jpa://[MyClass]?consumeLockEntity=true&consumer.SkipLockedEntity=true&consumer.query=[...]")
    .to("seda:queue.test")

I tried different solutions :

Is there other solution I forgot ? Is there (in the route configuration) some place to put "route ending method" ?

Thanks in advance !

Upvotes: 2

Views: 579

Answers (1)

teikitel
teikitel

Reputation: 699

Your second solution should work. I think your route ends up with a dead lock because your Bean tries to update your entity whereas you are already in a transaction. If that's the case, removing your update in your Bean should work.

Still your first sollution is worthsome. If someone tried it, I am interested to know if it worked.

Upvotes: 1

Related Questions