[ 
https://issues.apache.org/jira/browse/CAMEL-16501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18151635#comment-18151635
 ] 

Claus Ibsen commented on CAMEL-16501:
-------------------------------------

This is how camel-jpa works today: the EntityManager in the 
`CamelEntityManager` header is only used when the endpoint option 
`usePassedInEntityManager=true` (default false). Otherwise each 
EntityManagerFactory gets its own EntityManager, kept on the exchange keyed by 
the factory (see `JpaHelper.getTargetEntityManager`), which fixed the 
multiple-datasource problem of CAMEL-16470. Closing as done.

_Claude Code on behalf of davsclaus_

> camel-jpa - Avoid using EntityManager from header by default
> ------------------------------------------------------------
>
>                 Key: CAMEL-16501
>                 URL: https://issues.apache.org/jira/browse/CAMEL-16501
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-jpa
>            Reporter: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.x
>
>
> See CAMEL-16470
> Historically camel-jpa would lookup from exchange header / property an 
> EntityManager to use instead of from its own component. This was needed by 
> jbpm and other 3rd party frameworks that integrated with Camel.
> However this causes pain for normal users, where you just want to use the jpa 
> component out of the box with the JPA EM it has been configured with. And if 
> you add other jpa components to integrate with other databases, then they 
> should out of the box use their own EM and so on. This is how JMS, Kafka and 
> other components work.
> So to allow the old behavior, we add a boolean option on the jpa component to 
> turn on the old style. And then leave it off for new style onwards.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to