This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new dd3a991105f9 CAMEL-24130: camel-jpa - JpaMessageIdRepository should
not reuse EntityManager from exchange header (#24792)
dd3a991105f9 is described below
commit dd3a991105f9851235adfc93c86c1be4650a1b09
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Jul 16 15:41:05 2026 +0200
CAMEL-24130: camel-jpa - JpaMessageIdRepository should not reuse
EntityManager from exchange header (#24792)
Co-Authored-By: Claude Opus 4.6 <[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()) {