camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hekon...@apache.org
Subject git commit: [CAMEL-7126] Removed more JpaTemplate dependencies.
Date Thu, 16 Jan 2014 16:31:29 GMT
Updated Branches:
  refs/heads/master 45f38325c -> 456a9f50c


[CAMEL-7126] Removed more JpaTemplate dependencies.


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

Branch: refs/heads/master
Commit: 456a9f50c3c586e7ba882784b2a0af003fd3e030
Parents: 45f3832
Author: Henryk Konsek <hekonsek@gmail.com>
Authored: Thu Jan 16 17:30:18 2014 +0100
Committer: Henryk Konsek <hekonsek@gmail.com>
Committed: Thu Jan 16 17:31:06 2014 +0100

----------------------------------------------------------------------
 .../org/apache/camel/bam/model/ProcessDefinition.java   | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/456a9f50/components/camel-bam/src/main/java/org/apache/camel/bam/model/ProcessDefinition.java
----------------------------------------------------------------------
diff --git a/components/camel-bam/src/main/java/org/apache/camel/bam/model/ProcessDefinition.java
b/components/camel-bam/src/main/java/org/apache/camel/bam/model/ProcessDefinition.java
index 7e02bd8..67bf267 100644
--- a/components/camel-bam/src/main/java/org/apache/camel/bam/model/ProcessDefinition.java
+++ b/components/camel-bam/src/main/java/org/apache/camel/bam/model/ProcessDefinition.java
@@ -22,6 +22,7 @@ import java.util.Map;
 
 import javax.persistence.Column;
 import javax.persistence.Entity;
+import javax.persistence.EntityManager;
 import javax.persistence.Table;
 import org.apache.camel.bam.QueryUtils;
 import org.apache.camel.util.CastUtils;
@@ -30,6 +31,9 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.orm.jpa.JpaTemplate;
 
+import static org.apache.camel.bam.EntityManagers.closeNonTransactionalEntityManager;
+import static org.apache.camel.bam.EntityManagers.resolveEntityManager;
+
 /**
  * @version 
  */
@@ -59,7 +63,13 @@ public class ProcessDefinition extends EntitySupport {
             LOG.warn("No primary key is available!");
             return findOrCreateProcessDefinition(template, definition.getName());
         }
-        definition = template.find(ProcessDefinition.class, id);
+        EntityManager entityManager = null;
+        try {
+            entityManager = resolveEntityManager(template.getEntityManagerFactory());
+            definition = entityManager.find(ProcessDefinition.class, id);
+        } finally {
+            closeNonTransactionalEntityManager(entityManager);
+        }
         return definition;
     }
 


Mime
View raw message