deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject [3/6] git commit: DELTASPIKE-417 Use EntityManagerResolver result, set EM flush mode.
Date Wed, 02 Oct 2013 12:45:54 GMT
DELTASPIKE-417 Use EntityManagerResolver result, set EM flush mode.


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

Branch: refs/heads/master
Commit: e0132b6fe804291f8950fa2d107aa7d25cabb3a1
Parents: 92c0e77
Author: Thomas Hug <Thomas.Hug@ctp-consulting.com>
Authored: Wed Oct 2 10:57:10 2013 +0200
Committer: Thomas Hug <Thomas.Hug@ctp-consulting.com>
Committed: Wed Oct 2 11:10:47 2013 +0200

----------------------------------------------------------------------
 .../data/impl/handler/EntityManagerLookup.java     | 17 +++++++++++------
 .../data/impl/meta/RepositoryComponent.java        |  5 +++++
 2 files changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e0132b6f/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/EntityManagerLookup.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/EntityManagerLookup.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/EntityManagerLookup.java
index 25885aa..976ba70 100644
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/EntityManagerLookup.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/EntityManagerLookup.java
@@ -37,18 +37,23 @@ public class EntityManagerLookup
 
     public EntityManager lookupFor(RepositoryComponent repository)
     {
+        EntityManager result = null;
         if (repository.hasEntityManagerResolver())
         {
             DependentProvider<? extends EntityManagerResolver> resolver =
                     lookupResolver(repository.getEntityManagerResolverClass());
-            EntityManager result = resolver.get().resolveEntityManager();
-            if (repository.getEntityManagerFlushMode() != null)
-            {
-                result.setFlushMode(repository.getEntityManagerFlushMode());
-            }
+            result = resolver.get().resolveEntityManager();
             resolver.destroy();
         }
-        return entityManager.get();
+        else
+        {
+            result = entityManager.get();
+        }
+        if (repository.hasEntityManagerFlushMode())
+        {
+            result.setFlushMode(repository.getEntityManagerFlushMode());
+        }
+        return result;
     }
 
     private DependentProvider<? extends EntityManagerResolver> lookupResolver(

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e0132b6f/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/RepositoryComponent.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/RepositoryComponent.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/RepositoryComponent.java
index 4d9e30d..c2dc466 100644
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/RepositoryComponent.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/RepositoryComponent.java
@@ -142,6 +142,11 @@ public class RepositoryComponent
         return entityManagerResolver;
     }
 
+    public boolean hasEntityManagerFlushMode()
+    {
+        return entityManagerFlushMode != null;
+    }
+
     public FlushModeType getEntityManagerFlushMode()
     {
         return entityManagerFlushMode;


Mime
View raw message