openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ppod...@apache.org
Subject svn commit: r574293 - in /openjpa/trunk/openjpa-persistence/src/main: java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java resources/org/apache/openjpa/persistence/localizer.properties
Date Mon, 10 Sep 2007 16:20:17 GMT
Author: ppoddar
Date: Mon Sep 10 09:20:08 2007
New Revision: 574293

URL: http://svn.apache.org/viewvc?rev=574293&view=rev
Log:
OPENJPA-357, OPENJPA-358: Checking for user error of wrong fetch group inclusion

Modified:
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java
    openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java?rev=574293&r1=574292&r2=574293&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java
Mon Sep 10 09:20:08 2007
@@ -109,6 +109,8 @@
 import org.apache.openjpa.util.InternalException;
 import org.apache.openjpa.util.MetaDataException;
 import org.apache.openjpa.util.UnsupportedException;
+import org.apache.openjpa.util.UserException;
+
 import serp.util.Numbers;
 import serp.util.Strings;
 
@@ -897,12 +899,20 @@
                 fg.addDeclaredInclude(s);
             }
         }
-        
+        // Add the parent-child style bi-links between fetch groups in a 
+        // separate pass. 
         for (FetchGroup group:groups) {
         	fg = meta.getFetchGroup(group.name());
         	String[] includedFetchGropNames = fg.getDeclaredIncludes();
-        	for (String includedFectchGroupName:includedFetchGropNames)
-        	    meta.getFetchGroup(includedFectchGroupName).addContainedBy(fg);
+        	for (String includedFectchGroupName:includedFetchGropNames) {
+        		org.apache.openjpa.meta.FetchGroup child =
+        	    meta.getFetchGroup(includedFectchGroupName);
+        		if (child == null) 
+        			throw new UserException(_loc.get("missing-included-fg", 
+        				meta.getDescribedType().getName(), fg.getName(),
+        				includedFectchGroupName));
+        		child.addContainedBy(fg);
+        	}
         }
         
         for (FetchGroup group : groups) {

Modified: openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties?rev=574293&r1=574292&r2=574293&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties
Mon Sep 10 09:20:08 2007
@@ -59,6 +59,9 @@
 bad-fg-field: Fetch group "{0}" in type "{1}" includes field "{2}", but \
 	this field is not declared in "{1}", or is not persistent.  Currently, \
 	OpenJPA only supports declared fields in fetch groups.
+missing-included-fg:"{0}" declares a fecth group "{1}" includes "{2}". But \
+	the included fetch group "{2}" can not be found in "{0}". Currently, all \
+	included fetch groups must be declared within the same entity scope.
 not-update-delete-query: Cannot perform an update or delete operation \
 	on select query: "{0}".
 not-select-query: Cannot perform a select on update or delete query: "{0}".
@@ -141,3 +144,4 @@
 EntityManagerFactory-displayorder: 50
 EntityManagerFactory-expert: true
 EntityManagerFactory-interface: org.apache.openjpa.persistence.EntityManagerFactoryImpl
+



Mime
View raw message