// Create and cache EntityFetchGroups for named fetch groups.
if(this.fetchGroups != null) {
Iterator<FetchGroup> it = this.fetchGroups.values().iterator();
while(it.hasNext()) {
FetchGroup fetchGroup = it.next();
prepareAndVerify(fetchGroup);
getEntityFetchGroup(fetchGroup);
}
}
if(this.defaultFetchGroup == null) {
// Look up default fetch group set by user on parent descriptors
if(this.descriptor.isChildDescriptor() && this.shouldUseInheritedDefaultFetchGroup) {
ClassDescriptor current = this.descriptor;
while(current.isChildDescriptor()) {
ClassDescriptor parent = current.getInheritancePolicy().getParentDescriptor();
if (parent.hasFetchGroupManager()) {
this.defaultFetchGroup = parent.getFetchGroupManager().getDefaultFetchGroup();
if(this.defaultFetchGroup != null) {
return;
}
}
current = parent;
}
}
FetchGroup defaultCandidate = new FetchGroup();
boolean hasLazy = false;
for (DatabaseMapping mapping : getDescriptor().getMappings()) {
if (mapping.isForeignReferenceMapping() || (!mapping.isLazy())) {
defaultCandidate.addAttribute(mapping.getAttributeName());
} else {
hasLazy = true;
}
}
if(hasLazy) {