/** * Lookup the FetchGroup to use given a name and a flag taking into * consideration descriptor inheritance to ensure parent descriptors are * searched for named and default FetchGroup. This is used to determine the * FetchGroup to use in a query's prepare. */ public FetchGroup getFetchGroup(String groupName, boolean useDefault) { FetchGroup fg = null; if (groupName != null) { fg = getFetchGroup(groupName); } // Process default using hierarchy if (fg == null && useDefault) { fg = getDefaultFetchGroup(); } return fg; }
/** * Lookup the FetchGroup to use given a name and a flag taking into * consideration descriptor inheritance to ensure parent descriptors are * searched for named and default FetchGroup. This is used to determine the * FetchGroup to use in a query's prepare. */ public FetchGroup getFetchGroup(String groupName, boolean useDefault) { FetchGroup fg = null; if (groupName != null) { fg = getFetchGroup(groupName); } // Process default using hierarchy if (fg == null && useDefault) { fg = getDefaultFetchGroup(); } return fg; }
/** * INTERNAL: * Initialize fetch group */ public void initializeFetchGroup() { if (this.fetchGroup != null) { //fetch group already set. return; } //not explicitly set dynamically fetch group if (this.fetchGroupName != null) {//set pre-defined named group this.fetchGroup = getDescriptor().getFetchGroupManager().getFetchGroup(this.fetchGroupName); if (this.fetchGroup == null) { //named fetch group is not defined in the descriptor throw QueryException.fetchGroupNotDefinedInDescriptor(this.fetchGroupName); } } else {//not set fetch group at all //use the default fetch group if not explicitly turned off if (shouldUseDefaultFetchGroup()) { this.fetchGroup = getDescriptor().getDefaultFetchGroup(); } } }
ClassDescriptor parent = current.getInheritancePolicy().getParentDescriptor(); if (parent.hasFetchGroupManager()) { fg = parent.getFetchGroupManager().getFetchGroup(groupName);
ClassDescriptor parent = current.getInheritancePolicy().getParentDescriptor(); if (parent.hasFetchGroupManager()) { fg = parent.getFetchGroupManager().getFetchGroup(groupName);
if (this.fetchGroup == null) { if (this.fetchGroupName != null) { this.fetchGroup = fetchGroupManager.getFetchGroup(this.fetchGroupName); } else if (this.shouldUseDefaultFetchGroup) { this.fetchGroup = this.descriptor.getFetchGroupManager().getDefaultFetchGroup();
/** * INTERNAL: * Add mandatory attributes to fetch group, create entityFetchGroup. */ public void prepareFetchGroup() throws QueryException { FetchGroupManager fetchGroupManager = this.descriptor.getFetchGroupManager(); if (fetchGroupManager != null) { if (this.fetchGroup == null) { if (this.fetchGroupName != null) { this.fetchGroup = fetchGroupManager.getFetchGroup(this.fetchGroupName); } else if (this.shouldUseDefaultFetchGroup) { this.fetchGroup = this.descriptor.getFetchGroupManager().getDefaultFetchGroup(); } } if (this.fetchGroup != null) { if (hasPartialAttributeExpressions()) { //fetch group does not work with partial attribute reading throw QueryException.fetchGroupNotSupportOnPartialAttributeReading(); } // currently SOP is incompatible with fetch groups setShouldUseSerializedObjectPolicy(false); this.descriptor.getFetchGroupManager().prepareAndVerify(this.fetchGroup); } } else { // FetchGroupManager is null if (this.fetchGroup != null || this.fetchGroupName != null) { throw QueryException.fetchGroupValidOnlyIfFetchGroupManagerInDescriptor(getDescriptor().getJavaClassName(), getName()); } } }