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 2015/07/31 12:59:55 UTC

[6/9] isis git commit: ISIS-1182: improving error messages in RegisterEntities. minor update to migration notes.

ISIS-1182: improving error messages in RegisterEntities.  minor update to migration notes.


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

Branch: refs/heads/master
Commit: b584c787941b778122e9de4390af29b64afa4334
Parents: b83db19
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Fri Jul 31 11:43:00 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Fri Jul 31 11:43:00 2015 +0100

----------------------------------------------------------------------
 ...ion-notes_1.8.0-to-1.9.0_specify-all-dom-packages.adoc |  8 ++++++++
 .../isis/objectstore/jdo/service/RegisterEntities.java    | 10 ++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/b584c787/adocs/documentation/src/main/asciidoc/_migration-notes_1.8.0-to-1.9.0_specify-all-dom-packages.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/_migration-notes_1.8.0-to-1.9.0_specify-all-dom-packages.adoc b/adocs/documentation/src/main/asciidoc/_migration-notes_1.8.0-to-1.9.0_specify-all-dom-packages.adoc
index 72cc639..88b1a05 100644
--- a/adocs/documentation/src/main/asciidoc/_migration-notes_1.8.0-to-1.9.0_specify-all-dom-packages.adoc
+++ b/adocs/documentation/src/main/asciidoc/_migration-notes_1.8.0-to-1.9.0_specify-all-dom-packages.adoc
@@ -33,3 +33,11 @@ isis.persistor.datanucleus.RegisterEntities.packagePrefix=\
                 org.isisaddons.module.audit.dom,\
                 org.isisaddons.module.publishing.dom
 ----
+
+[TIP]
+====
+Alternatively, could have just specified `org.isisaddons.module` instead of enumerating every addon.  This would be a bit slower, but more maintainable.
+====
+
+
+If you fail to do this then DataNucleus will build up its metamodel lazily, rather than validate all classes up-front.  This can call issues: we've seen malformed SQL being submitted when DN wasn't aware of subclasses of a superclass, and we've also seen deadlocks when running against HSQLDB as it attempts to perform a DDL statement intermixed with DML statements.

http://git-wip-us.apache.org/repos/asf/isis/blob/b584c787/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/service/RegisterEntities.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/service/RegisterEntities.java b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/service/RegisterEntities.java
index 1892594..09c446f 100644
--- a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/service/RegisterEntities.java
+++ b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/service/RegisterEntities.java
@@ -43,7 +43,9 @@ public class RegisterEntities {
     public RegisterEntities(final Map<String, String> configuration) {
         String packagePrefixes = configuration.get(PACKAGE_PREFIX_KEY);
         if(Strings.isNullOrEmpty(packagePrefixes)) {
-            throw new IllegalStateException("Could not locate '" + PACKAGE_PREFIX_KEY + "' key in property files - aborting");
+            throw new IllegalArgumentException(String.format(
+                    "Could not locate '%s' key in property files - aborting",
+                    PACKAGE_PREFIX_KEY));
         }
 
         domPackages = parseDomPackages(packagePrefixes);
@@ -74,7 +76,11 @@ public class RegisterEntities {
         for (final String packagePrefix : domPackages) {
             final Iterable<String> entityTypes1 = ScanUtils.scanForNamesOfClassesWithAnnotation(domPackages, PersistenceCapable.class);
             if(Iterables.isEmpty(entityTypes1)) {
-                throw new IllegalStateException("Could not locate any @PersistenceCapable entities in package " + packagePrefix);
+                throw new IllegalArgumentException(String.format(
+                        "Bad configuration.\n\nCould not locate any @PersistenceCapable entities in package '%s'\n" +
+                        "Check value of '%s' key in isis.properties etc.\n",
+                        packagePrefix,
+                        PACKAGE_PREFIX_KEY));
             }
             Iterables.addAll(entityTypes, entityTypes1);
         }