diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FetchGroup.java b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FetchGroup.java index 2407bed63..bae011531 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FetchGroup.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/meta/FetchGroup.java @@ -274,9 +274,11 @@ public class FetchGroup { if (_meta != null) { ClassMetaData sup = _meta.getPCSuperclassMetaData(); - FetchGroup supFG = sup.getFetchGroup(_name); - if (supFG != null && supFG.isPostLoad()) - return true; + if (sup != null) { + FetchGroup supFG = sup.getFetchGroup(_name); + if (supFG != null && supFG.isPostLoad()) + return true; + } } if (_includes == null) diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java index 82ac71fba..cb85978ed 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java @@ -884,6 +884,7 @@ public class AnnotationPersistenceMetaDataParser throw new MetaDataException(_loc.get("bad-fg-field", fg.getName(), meta, attr.name())); + field.setInFetchGroup(fg.getName(), true); if (attr.recursionDepth() != Integer.MIN_VALUE) fg.setRecursionDepth(field, attr.recursionDepth()); }