camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Usage JPA in a bean with CamelJPA
Date Sat, 27 Feb 2016 10:07:50 GMT
Are you talking about writing some Java JPA code in a Java bean? And
then calling that Java bean from a Camel route?

Then yeah sure, then you are responsible for the JPA code, and to
obtain the EntityManagerFactory and all that JPA stuff you must do.
Also to call flush or whatnot so any changes are persistent to the database.

You do not have to use Camel JPA component at all. You can just do
this the regular JPA code way.

And if you talk about a transaction, then you would need to make sure
the TX manager works with JPA and setup all that correctly as well.



On Sat, Feb 27, 2016 at 9:59 AM, fharms <flemming.harms@gmail.com> wrote:
> Hi
>
> I have question regarding using Camel JPA together with beans
>
> Is it correctly understood if I’m using JPA in a bean, but does not directly
> consume or sending to an endpoint via “jpa:”,  then i’m responsible for
> creating the entity manager because the CamelEntityManager header is only
> set when the route use the JPA URI protocol?
>
> Will the solution be to injecting the JpaComponent in my bean, and create an
> EntityManager and join the transaction, will that be a correct way or is
> there a better way?
>
> Thanks!
>
> Cheers,
> Flemming
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Usage-JPA-in-a-bean-with-CamelJPA-tp5778349.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Mime
View raw message