davsclaus commented on code in PR #8141:
URL: https://github.com/apache/camel/pull/8141#discussion_r943125337
##########
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:
When the splitter creates sub exchanges it copies from the parent.
To reuse the same transaction manager, then we could
1) Add a constant for this in Exchange (so its in core)
2) Copy over the existing TM in the sub exchange if its transacted (in the
splitter) (see link below)
3) There are other EIPs that should do as 2 (Multicast, Recipient List,
Enricher) but not wiretap
https://github.com/apache/camel/blob/991f9ca7898bfea362821ef115d930fece317230/core/camel-core-processor/src/main/java/org/apache/camel/processor/Splitter.java#L231
--
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]