deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject deltaspike git commit: DELTASPIKE-1161 [perf] avoid Instance#Select
Date Fri, 03 Jun 2016 08:42:51 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master c14297ce2 -> 0e7629161


DELTASPIKE-1161 [perf] avoid Instance#Select

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

Branch: refs/heads/master
Commit: 0e762916160e19e7c3433857fdc58744bf11ca8e
Parents: c14297c
Author: tandraschko <tandraschko@apache.org>
Authored: Fri Jun 3 10:42:19 2016 +0200
Committer: tandraschko <tandraschko@apache.org>
Committed: Fri Jun 3 10:42:19 2016 +0200

----------------------------------------------------------------------
 .../data/impl/handler/EntityManagerRefLookup.java    | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/0e762916/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/EntityManagerRefLookup.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/EntityManagerRefLookup.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/EntityManagerRefLookup.java
index aab17be..a7066cc 100644
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/EntityManagerRefLookup.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/EntityManagerRefLookup.java
@@ -18,7 +18,6 @@
  */
 package org.apache.deltaspike.data.impl.handler;
 
-import java.lang.annotation.Annotation;
 import java.util.Set;
 import javax.enterprise.context.ApplicationScoped;
 import javax.enterprise.inject.spi.Bean;
@@ -60,10 +59,18 @@ public class EntityManagerRefLookup
             Set<Bean<?>> beans = beanManager.getBeans(EntityManager.class);
             Bean<?> bean = beanManager.resolve(beans);
 
+            if (bean == null)
+            {
+                throw new IllegalStateException("Could not find EntityManager with default
qualifier.");
+            }
+            
             globalEntityManagerIsNormalScope = beanManager.isNormalScope(bean.getScope());
-            globalEntityManager = (EntityManager) beanManager.getReference(bean,
-                    EntityManager.class,
-                    beanManager.createCreationalContext(bean));       
+            if (globalEntityManagerIsNormalScope)
+            {
+                globalEntityManager = (EntityManager) beanManager.getReference(bean,
+                        EntityManager.class,
+                        beanManager.createCreationalContext(bean));       
+            }
         }
     }
     


Mime
View raw message