This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch fix/CAMEL-24130 in repository https://gitbox.apache.org/repos/asf/camel.git
commit 1fa6f80d02e50d363bc64bca1c541c7850b83442 Author: Claus Ibsen <[email protected]> AuthorDate: Thu Jul 16 14:08:25 2026 +0200 CAMEL-24130: camel-jpa - JpaMessageIdRepository should not reuse EntityManager from exchange header Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../camel/processor/idempotent/jpa/JpaMessageIdRepository.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/components/camel-jpa/src/main/java/org/apache/camel/processor/idempotent/jpa/JpaMessageIdRepository.java b/components/camel-jpa/src/main/java/org/apache/camel/processor/idempotent/jpa/JpaMessageIdRepository.java index 0194d3218c12..30f6d25a1d47 100644 --- a/components/camel-jpa/src/main/java/org/apache/camel/processor/idempotent/jpa/JpaMessageIdRepository.java +++ b/components/camel-jpa/src/main/java/org/apache/camel/processor/idempotent/jpa/JpaMessageIdRepository.java @@ -90,7 +90,7 @@ public class JpaMessageIdRepository extends ServiceSupport implements Idempotent @Override public boolean add(final Exchange exchange, final String messageId) { final EntityManager entityManager - = getTargetEntityManager(exchange, entityManagerFactory, true, sharedEntityManager, true); + = getTargetEntityManager(exchange, entityManagerFactory, false, sharedEntityManager, true); // Run this in single transaction. final Boolean[] rc = new Boolean[1]; transactionStrategy.executeInTransaction(() -> { @@ -139,7 +139,7 @@ public class JpaMessageIdRepository extends ServiceSupport implements Idempotent @Override public boolean contains(final Exchange exchange, final String messageId) { final EntityManager entityManager - = getTargetEntityManager(exchange, entityManagerFactory, true, sharedEntityManager, true); + = getTargetEntityManager(exchange, entityManagerFactory, false, sharedEntityManager, true); // Run this in single transaction. final Boolean[] rc = new Boolean[1]; @@ -181,7 +181,7 @@ public class JpaMessageIdRepository extends ServiceSupport implements Idempotent @Override public boolean remove(final Exchange exchange, final String messageId) { final EntityManager entityManager - = getTargetEntityManager(exchange, entityManagerFactory, true, sharedEntityManager, true); + = getTargetEntityManager(exchange, entityManagerFactory, false, sharedEntityManager, true); Boolean[] rc = new Boolean[1]; transactionStrategy.executeInTransaction(() -> { @@ -231,7 +231,8 @@ public class JpaMessageIdRepository extends ServiceSupport implements Idempotent @Override @ManagedOperation(description = "Clear the store") public void clear() { - final EntityManager entityManager = getTargetEntityManager(null, entityManagerFactory, true, sharedEntityManager, true); + final EntityManager entityManager + = getTargetEntityManager(null, entityManagerFactory, false, sharedEntityManager, true); transactionStrategy.executeInTransaction(() -> { if (isJoinTransaction()) {
