closing entity manager

Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a1da0113
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a1da0113
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a1da0113

Branch: refs/heads/camel-2.18.x
Commit: a1da0113ce28253ea4d34203df9c86da0ef8948d
Parents: 1a30497
Author: mkcochran <mcoch...@redhat.com>
Authored: Thu Aug 10 15:54:38 2017 -0400
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Sun Aug 13 01:55:04 2017 +0200

----------------------------------------------------------------------
 .../camel/processor/idempotent/jpa/JpaMessageIdRepository.java    | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a1da0113/components/camel-jpa/src/main/java/org/apache/camel/processor/idempotent/jpa/JpaMessageIdRepository.java
----------------------------------------------------------------------
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 f992715..1d9b717 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
@@ -104,6 +104,7 @@ public class JpaMessageIdRepository extends ServiceSupport 
implements ExchangeId
                     processed.setCreatedAt(new Date());
                     entityManager.persist(processed);
                     entityManager.flush();
+                    entityManager.close();
                     return Boolean.TRUE;
                 } else {
                     return Boolean.FALSE;
@@ -166,6 +167,7 @@ public class JpaMessageIdRepository extends ServiceSupport 
implements ExchangeId
                     MessageProcessed processed = (MessageProcessed) 
list.get(0);
                     entityManager.remove(processed);
                     entityManager.flush();
+                    entityManager.close();
                     return Boolean.TRUE;
                 }
             }
@@ -204,6 +206,7 @@ public class JpaMessageIdRepository extends ServiceSupport 
implements ExchangeId
                         entityManager.remove(item);
                     }
                     entityManager.flush();
+                    entityManager.close();
                 }
                 return Boolean.TRUE;
             }

Reply via email to