You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ig...@apache.org on 2017/08/23 16:33:22 UTC
camel git commit: CAMEL-9608 following up to take care of
sharedEntityManager
Repository: camel
Updated Branches:
refs/heads/master 94a10c42e -> ed36cf334
CAMEL-9608 following up to take care of sharedEntityManager
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ed36cf33
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ed36cf33
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ed36cf33
Branch: refs/heads/master
Commit: ed36cf3348cf5388055f95484fcb7e580170d6f3
Parents: 94a10c4
Author: Tomohisa Igarashi <tm...@gmail.com>
Authored: Wed Aug 23 12:29:18 2017 -0400
Committer: Tomohisa Igarashi <tm...@gmail.com>
Committed: Wed Aug 23 12:32:32 2017 -0400
----------------------------------------------------------------------
.../main/java/org/apache/camel/component/jpa/JpaConsumer.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/ed36cf33/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java
index a426077..43e69b5 100644
--- a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java
+++ b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java
@@ -93,7 +93,11 @@ public class JpaConsumer extends ScheduledBatchPollingConsumer {
// Recreate EntityManager in case it is disposed due to transaction rollback
if (entityManager == null) {
- entityManager = entityManagerFactory.createEntityManager();
+ if (getEndpoint().isSharedEntityManager()) {
+ this.entityManager = SharedEntityManagerCreator.createSharedEntityManager(entityManagerFactory);
+ } else {
+ this.entityManager = entityManagerFactory.createEntityManager();
+ }
LOG.trace("Recreated EntityManager {} on {}", entityManager, this);
}