zhfeng commented on code in PR #8141:
URL: https://github.com/apache/camel/pull/8141#discussion_r946313974
##########
components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaHelper.java:
##########
@@ -60,6 +62,15 @@ public static EntityManager getTargetEntityManager(
em =
getEntityManagerMap(exchange).get(getKey(entityManagerFactory));
}
+ // then try to reuse one from the current transaction if possible
+ if (em == null &&
TransactionSynchronizationManager.hasResource(entityManagerFactory)) {
Review Comment:
I add the similar changes to `multicast` and `recipientList` processors.
Aslo an unit test has been added to test with a pooling data source. For
`enrich`, the default aggreate stragtegy is using the new exchange, so it works
with transacted. But if the custom aggregate stragtegy is used, the users have
to copy `JpaConstants.ENTITY_MANAGE` propery from the newExchange by
themseleves. I also provide `JpaHelper.copyEntityManagers` method to do this
copying.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]