mirror of https://github.com/apache/openjpa.git
OPENJPA-357, OPENJPA-358: Checking for user error of wrong fetch group inclusion
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@574293 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6d5fe3bb8a
commit
7c07cc6d1d
|
@ -109,6 +109,8 @@ import org.apache.openjpa.util.ImplHelper;
|
|||
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 @@ public class AnnotationPersistenceMetaDataParser
|
|||
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) {
|
||||
|
|
|
@ -59,6 +59,9 @@ unnamed-fg: "{0}" declares an unnamed fetch group. All fetch groups \
|
|||
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-cat: Persistence.Advanced
|
|||
EntityManagerFactory-displayorder: 50
|
||||
EntityManagerFactory-expert: true
|
||||
EntityManagerFactory-interface: org.apache.openjpa.persistence.EntityManagerFactoryImpl
|
||||
|
||||
|
|
Loading…
Reference in New Issue