You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2018/08/23 09:48:54 UTC

[isis] 04/07: ISIS-1974: moves catalogNamedQueries out of DataNucleusApplicatoinComponents, and into its caller, PersistenceSessoinFactory

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch maint-1.16.2
in repository https://gitbox.apache.org/repos/asf/isis.git

commit d09937bb5d5a559842b1439d25c82023a548e58f
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Wed Aug 22 13:36:31 2018 +0100

    ISIS-1974: moves catalogNamedQueries out of DataNucleusApplicatoinComponents, and into its caller, PersistenceSessoinFactory
---
 .../system/persistence/DataNucleusApplicationComponents.java  | 11 ++---------
 .../runtime/system/persistence/PersistenceSessionFactory.java |  2 ++
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/DataNucleusApplicationComponents.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/DataNucleusApplicationComponents.java
index ca45ec9..657ea78 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/DataNucleusApplicationComponents.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/DataNucleusApplicationComponents.java
@@ -84,7 +84,6 @@ public class DataNucleusApplicationComponents implements ApplicationScopedCompon
     private final SpecificationLoader specificationLoader;
     private final Map<String, String> datanucleusProps;
     
-    private Map<String, JdoNamedQuery> namedQueryByName;
     private PersistenceManagerFactory persistenceManagerFactory;
 
     public DataNucleusApplicationComponents(
@@ -98,18 +97,12 @@ public class DataNucleusApplicationComponents implements ApplicationScopedCompon
         this.persistableClassNameSet = persistableClassNameSet;
         this.jdoObjectstoreConfig = configuration;
 
-        initialize();
-        
+        persistenceManagerFactory = createPmfAndSchemaIfRequired(this.persistableClassNameSet, this.datanucleusProps);
+
         // for JRebel plugin
         instance = this;
     }
 
-    private void initialize() {
-        persistenceManagerFactory = createPmfAndSchemaIfRequired(persistableClassNameSet, datanucleusProps);
-
-        namedQueryByName = catalogNamedQueries(persistableClassNameSet, specificationLoader);
-    }
-
     private static boolean isSchemaAwareStoreManager(Map<String,String> datanucleusProps) {
 
         // we create a throw-away instance of PMF so that we can probe whether DN has
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
index fc2849a..4d05f28 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
@@ -103,6 +103,8 @@ public class PersistenceSessionFactory implements ApplicationScopedComponent, Fi
 
             applicationComponents = new DataNucleusApplicationComponents(jdoObjectstoreConfig, specificationLoader,
                     datanucleusProps, classesToBePersisted);
+
+            DataNucleusApplicationComponents.catalogNamedQueries(classesToBePersisted, specificationLoader);
         }
 
         return applicationComponents;