camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erik_romson <e...@zenior.no>
Subject spring boot, jpa, entitymanagers and Java DSL
Date Wed, 10 Jun 2015 07:05:19 GMT
Hi,
I'm a bit confused regarding the JPA endpoint and entitymanagers.

I'm using spring boot and using the *default* entitymanager. As the
documentation points out, the endpoints use different entity managers

There are documentation of how to set an entity manager using spring xml or
creating a JPA endpoint (new JpaComponent(), set entity Manager etc)

if I have a route

from("jpa://SomeEntity?consumer.namedQuery=query")
.process(ReadSomeOtherStuffWithEntityManager())
.to("jpa://SomeOtherEntity") 


to have the same entityManagerFactory my plan was to use

JpaComponent jpaComponent=new JpaComponent();
//injected entitymanager from spring
jpaComponent.setEntityManagerFactory(entityManager.getEntityManagerFactory());
jpaComponent.setJoinTransaction(false);
jpaComponent.setCamelContext(getContext());
JpaEndpoint jpaEndpointPerson= new
JpaEndpoint(jpa://SomeEntity?consumer.namedQuery=query,jpaComponent);

and add it to the from() in the route and thereafter use the passed along
entity manager.

This doesn't work as as the jpaEndpoint doesn't parse/read the uri (nothing
is set in org.apache.camel.component.jpa.JpaConsumer#createQueryFactory)


I'm probably blind but I fail to find any documentation on how to do this.
Any pointers would be very appreciated. 

Also with the upcoming setting *sharedEntityManager* in Camel 2.16, would
this solve all my problems?



--
View this message in context: http://camel.465427.n5.nabble.com/spring-boot-jpa-entitymanagers-and-Java-DSL-tp5768055.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message