Purpose: The fetch group manager controls the named fetch groups defined at the descriptor level. EclipseLink supports multiple, overlapped fetch groups, optionally with one of them as the default fetch group.
The domain object must implement org.eclipse.persistence.queries.FetchGroupTracker interface, in order to make use of the fetch group performance enhancement feature.
Please refer to FetchGroup class for the pros and cons of fetch group usage.
org.eclipse.persistence.queries.FetchGroup , org.eclipse.persistence.queries.FetchGroupTracker
| Modifier and Type | Field and Description |
|---|---|
| private EntityFetchGroup | |
| private FetchGroup | |
| private ClassDescriptor | |
| private transient Map | |
| private Map | |
| private FetchGroup | |
| private EntityFetchGroup | |
| private FetchGroup | |
| private EntityFetchGroup | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | addMinimalFetchGroup(FetchGroup fetchGroup)
INTERNAL: Add primary key and version attributes to the passed fetch group. |
| public Object | |
| public void | copyAggregateFetchGroupInto(Object source, Object target, Object rootEntity, AbstractSession session)
INTERNAL: Copy fetch group reference from the source object to the target |
| public void | copyFetchGroupInto(Object source, Object target, AbstractSession session)
INTERNAL: Copy fetch group reference from the source object to the target |
| public FetchGroup | |
| public FetchGroup | createFullFetchGroup()
PUBLIC: Returns clone of the full fetch group - contains all the attributes, no nesting. |
| public FetchGroup | |
| public EntityFetchGroup | flatUnionFetchGroups(FetchGroup first, FetchGroup second, boolean shouldClone)
INTERNAL: Union two fetch groups as EntityFetchGroups. |
| public EntityFetchGroup | |
| public FetchGroup | |
| public ClassDescriptor | |
| public EntityFetchGroup | getEntityFetchGroup(Set<String> attributeNames)
INTERNAL: Returns entity fetch group corresponding to the passed set of attributes. |
| public EntityFetchGroup | getEntityFetchGroup(FetchGroup fetchGroup)
INTERNAL: Returns entity fetch group corresponding to the passed fetch group. |
| public FetchGroup | |
| public FetchGroup | getFetchGroup(String groupName, boolean useDefault)
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. |
| public Map | getFetchGroups()
Return the fetch group map: keyed by the group name, valued by the fetch group object. |
| public EntityFetchGroup | getIdEntityFetchGroup()
INTERNAL: Returns EntityFetchGroup corresponding to primary key attribute(s). |
| public EntityFetchGroup | getNonReferenceEntityFetchGroup()
INTERNAL: Returns EntityFetchGroup corresponding to non relational attributes intersected with defaultFetchGroup. |
| public EntityFetchGroup | getNonReferenceEntityFetchGroup(boolean addPk, boolean addVersion)
INTERNAL: Returns EntityFetchGroup corresponding to non relational attributes intersected with defaultFetchGroup. |
| public EntityFetchGroup | |
| public FetchGroup | |
| public boolean | |
| public void | |
| protected void | |
| public boolean | isAttributeFetched(Object entity, String attributeName)
Return true if the attribute of the object has already been fetched |
| public boolean | isFullFetchGroup(FetchGroup fetchGroup)
PUBLIC: Indicates whether the passed fetch group contains all the attributes, no nesting. |
| public boolean | isMinimalFetchGroup(FetchGroup fetchGroup)
PUBLIC: Indicates whether the passed fetch group is minimal. |
| public boolean | isObjectValidForFetchGroup(Object object, FetchGroup fetchGroup)
INTERNAL: Return if the cached object data is sufficiently valid against a fetch group |
| public boolean | isPartialObject(Object domainObject)
INTERNAL: Return true if the object is partially fetched and cached. |
| public void | postInitialize(AbstractSession session)
INTERNAL: postInitialize called for inheritance children first. |
| public void | prepareAndVerify(FetchGroup fetchGroup)
PUBLIC: Add primary key and version attributes to the passed fetch group and all the fetch group it contains. |
| protected void | prepareAndVerifyInternal(FetchGroup fetchGroup, String attributePrefix)
INTERNAL: Add primary key and version attributes to the passed fetch group and all the fetch group it contains. |
| private void | refreshFetchGroupIntoClones(Object cachedObject, Object workingClone, Object backupClone, FetchGroup fetchGroupInObject, FetchGroup fetchGroupInClone, UnitOfWorkImpl uow)
INTERNAL: Refresh the fetch group data into the working and backup clones. |
| public void | |
| private void | revertDataIntoUnfetchedAttributesOfClones(Object cachedObject, Object workingClone, Object backupClone, FetchGroup fetchGroupInObject, FetchGroup fetchGroupInClone, UnitOfWorkImpl uow)
Revert the clones' unfetched attributes, and leave fetched ones intact. |
| public void | |
| public void | |
| public void | setObjectFetchGroup(Object source, FetchGroup fetchGroup, AbstractSession session)
INTERNAL: Set fetch group into the object. |
| public void | setRefreshOnFetchGroupToObject(Object source, boolean shouldRefreshOnFetchgroup)
INTERNAL: Set if the tracked object is fetched from executing a query with or without refresh. |
| public void | setShouldUseInheritedDefaultFetchGroup(boolean shouldUseInheritedDefaultFetchGroup)
PUBLIC: Set whether defaultFetchGroup should be copied from the parent if not set. |
| public boolean | shouldUseInheritedDefaultFetchGroup()
PUBLIC: Indicates whether defaultFetchGroup should be copied from the parent if not set. |
| public boolean | shouldWriteInto(Object cachedObject, Object clone)
INTERNAL: Return true if the cached object data should be written in clone. |
| public void | unionEntityFetchGroupIntoObject(Object source, EntityFetchGroup newEntityFetchGroup, AbstractSession session, boolean shouldClone)
INTERNAL: Union the fetch group of the domain object with the new fetch group. |
| public FetchGroup | |
| public void | writePartialIntoClones(Object partialObject, Object workingClone, Object backupClone, UnitOfWorkImpl uow)
INTERNAL: Write data of the partially fetched object into the working and backup clones |
| defaultEntityFetchGroup | back to summary |
|---|---|
| private EntityFetchGroup defaultEntityFetchGroup | |
| defaultFetchGroup | back to summary |
|---|---|
| private FetchGroup defaultFetchGroup | |
| descriptor | back to summary |
|---|---|
| private ClassDescriptor descriptor | |
| entityFetchGroups | back to summary |
|---|---|
| private transient Map<Set<String>, EntityFetchGroup> entityFetchGroups | |
| fetchGroups | back to summary |
|---|---|
| private Map<String, FetchGroup> fetchGroups | |
| fullFetchGroup | back to summary |
|---|---|
| private FetchGroup fullFetchGroup | |
| idEntityFetchGroup | back to summary |
|---|---|
| private EntityFetchGroup idEntityFetchGroup | |
| minimalFetchGroup | back to summary |
|---|---|
| private FetchGroup minimalFetchGroup | |
| nonReferenceEntityFetchGroup | back to summary |
|---|---|
| private EntityFetchGroup nonReferenceEntityFetchGroup | |
| shouldUseInheritedDefaultFetchGroup | back to summary |
|---|---|
| private boolean shouldUseInheritedDefaultFetchGroup | |
| FetchGroupManager | back to summary |
|---|---|
| public FetchGroupManager() Constructor | |
| addFetchGroup | back to summary |
|---|---|
| public void addFetchGroup(FetchGroup group) Add a named fetch group to the descriptor | |
| addMinimalFetchGroup | back to summary |
|---|---|
| public void addMinimalFetchGroup(FetchGroup fetchGroup) INTERNAL: Add primary key and version attributes to the passed fetch group. | |
| clone | back to summary |
|---|---|
| public Object clone() Overrides java. INTERNAL: Clone the fetch group manager.
| |
| copyAggregateFetchGroupInto | back to summary |
|---|---|
| public void copyAggregateFetchGroupInto(Object source, Object target, Object rootEntity, AbstractSession session) INTERNAL: Copy fetch group reference from the source object to the target | |
| copyFetchGroupInto | back to summary |
|---|---|
| public void copyFetchGroupInto(Object source, Object target, AbstractSession session) INTERNAL: Copy fetch group reference from the source object to the target | |
| createDefaultFetchGroup | back to summary |
|---|---|
| public FetchGroup createDefaultFetchGroup() PUBLIC: Returns clone of the default fetch group. Could be used as a starting point for a new user-defined fetch group. | |
| createFullFetchGroup | back to summary |
|---|---|
| public FetchGroup createFullFetchGroup() PUBLIC: Returns clone of the full fetch group - contains all the attributes, no nesting. Could be used as a starting point for a new user-defined fetch group. | |
| createMinimalFetchGroup | back to summary |
|---|---|
| public FetchGroup createMinimalFetchGroup() PUBLIC: Returns clone of the minimal fetch group. Could be used as a starting point for a new user-defined fetch group. | |
| flatUnionFetchGroups | back to summary |
|---|---|
| public EntityFetchGroup flatUnionFetchGroups(FetchGroup first, FetchGroup second, boolean shouldClone) INTERNAL: Union two fetch groups as EntityFetchGroups. Ignores all nested attributes. | |
| getDefaultEntityFetchGroup | back to summary |
|---|---|
| public EntityFetchGroup getDefaultEntityFetchGroup() INTERNAL: Returns EntityFetchGroup corresponding to default FetchGroup. | |
| getDefaultFetchGroup | back to summary |
|---|---|
| public FetchGroup getDefaultFetchGroup() Return the descriptor-level default fetch group. All read object and read all queries would use the default fetch group if no fetch group is explicitly defined for the query, unless setShouldUseDefaultFetchGroup(false); is also called on the query. Default fetch group should be used carefully. It would be beneficial if most of the system queries are for the subset of the object, so un-needed attributes data would not have to be read, and the users do not have to setup every query for the given fetch group, as default one is always used. However, if queries on object are mostly use case specific and not systematic, using default fetch group could cause undesirable extra round-trip and performance degradation. | |
| getDescriptor | back to summary |
|---|---|
| public ClassDescriptor getDescriptor() PUBLIC: Return the referenced descriptor. | |
| getEntityFetchGroup | back to summary |
|---|---|
| public EntityFetchGroup getEntityFetchGroup(Set<String> attributeNames) INTERNAL: Returns entity fetch group corresponding to the passed set of attributes. | |
| getEntityFetchGroup | back to summary |
|---|---|
| public EntityFetchGroup getEntityFetchGroup(FetchGroup fetchGroup) INTERNAL: Returns entity fetch group corresponding to the passed fetch group. | |
| getFetchGroup | back to summary |
|---|---|
| public FetchGroup getFetchGroup(String groupName) Return a pre-defined named fetch group. Lookup the FetchGroup to use given a name taking into consideration descriptor inheritance to ensure parent descriptors are searched for named FetchGroups. | |
| getFetchGroup | back to summary |
|---|---|
| public FetchGroup getFetchGroup(String groupName, boolean useDefault) 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. | |
| getFetchGroups | back to summary |
|---|---|
| public Map Return the fetch group map: keyed by the group name, valued by the fetch group object. | |
| getIdEntityFetchGroup | back to summary |
|---|---|
| public EntityFetchGroup getIdEntityFetchGroup() INTERNAL: Returns EntityFetchGroup corresponding to primary key attribute(s). | |
| getNonReferenceEntityFetchGroup | back to summary |
|---|---|
| public EntityFetchGroup getNonReferenceEntityFetchGroup() INTERNAL: Returns EntityFetchGroup corresponding to non relational attributes intersected with defaultFetchGroup. | |
| getNonReferenceEntityFetchGroup | back to summary |
|---|---|
| public EntityFetchGroup getNonReferenceEntityFetchGroup(boolean addPk, boolean addVersion) INTERNAL: Returns EntityFetchGroup corresponding to non relational attributes intersected with defaultFetchGroup. | |
| getObjectEntityFetchGroup | back to summary |
|---|---|
| public EntityFetchGroup getObjectEntityFetchGroup(Object domainObject) INTERNAL: Return FetchGroup held by the object. | |
| getObjectFetchGroup | back to summary |
|---|---|
| public FetchGroup getObjectFetchGroup(Object domainObject) INTERNAL: Return FetchGroup held by the object. | |
| hasFetchGroup | back to summary |
|---|---|
| public boolean hasFetchGroup(String groupName) Return true if a fetch group exists for the given group name. | |
| initialize | back to summary |
|---|---|
| public void initialize(AbstractSession session) throws DescriptorException INTERNAL: Initialize the fetch groups. XXX-dclarke: added support for reinit the query manager's queries if they exist | |
| initNonReferenceEntityFetchGroup | back to summary |
|---|---|
| protected void initNonReferenceEntityFetchGroup() | |
| isAttributeFetched | back to summary |
|---|---|
| public boolean isAttributeFetched(Object entity, String attributeName) Return true if the attribute of the object has already been fetched | |
| isFullFetchGroup | back to summary |
|---|---|
| public boolean isFullFetchGroup(FetchGroup fetchGroup) PUBLIC: Indicates whether the passed fetch group contains all the attributes, no nesting. | |
| isMinimalFetchGroup | back to summary |
|---|---|
| public boolean isMinimalFetchGroup(FetchGroup fetchGroup) PUBLIC: Indicates whether the passed fetch group is minimal. | |
| isObjectValidForFetchGroup | back to summary |
|---|---|
| public boolean isObjectValidForFetchGroup(Object object, FetchGroup fetchGroup) INTERNAL: Return if the cached object data is sufficiently valid against a fetch group | |
| isPartialObject | back to summary |
|---|---|
| public boolean isPartialObject(Object domainObject) INTERNAL: Return true if the object is partially fetched and cached. It applies to the query with fetch group. | |
| postInitialize | back to summary |
|---|---|
| public void postInitialize(AbstractSession session) throws DescriptorException INTERNAL: postInitialize called for inheritance children first. That allows to copy defaultFetchGroup from the parent only in case it has been set by user (not automatically generated). | |
| prepareAndVerify | back to summary |
|---|---|
| public void prepareAndVerify(FetchGroup fetchGroup) PUBLIC: Add primary key and version attributes to the passed fetch group and all the fetch group it contains. Also verifies that all the attributes have corresponding mappings. Could be used for fetch group preparation and validation. Called by ObjectLevelReadQuery prepareFetchgroup method. | |
| prepareAndVerifyInternal | back to summary |
|---|---|
| protected void prepareAndVerifyInternal(FetchGroup fetchGroup, String attributePrefix) INTERNAL: Add primary key and version attributes to the passed fetch group and all the fetch group it contains. Also verifies that all the attributes have corresponding mappings. | |
| refreshFetchGroupIntoClones | back to summary |
|---|---|
| private void refreshFetchGroupIntoClones(Object cachedObject, Object workingClone, Object backupClone, FetchGroup fetchGroupInObject, FetchGroup fetchGroupInClone, UnitOfWorkImpl uow) INTERNAL: Refresh the fetch group data into the working and backup clones. This is called if refresh is enforced | |
| reset | back to summary |
|---|---|
| public void reset(Object source) INTERNAL: Reset object attributes to the default values. | |
| revertDataIntoUnfetchedAttributesOfClones | back to summary |
|---|---|
| private void revertDataIntoUnfetchedAttributesOfClones(Object cachedObject, Object workingClone, Object backupClone, FetchGroup fetchGroupInObject, FetchGroup fetchGroupInClone, UnitOfWorkImpl uow) Revert the clones' unfetched attributes, and leave fetched ones intact. | |
| setDefaultFetchGroup | back to summary |
|---|---|
| public void setDefaultFetchGroup(FetchGroup newDefaultFetchGroup) Set the descriptor-level default fetch group. All read object and read all queries would use the default fetch group if no fetch group is explicitly defined for the query, unless setShouldUseDefaultFetchGroup(false); is also called on the query. Default fetch group should be used carefully. It would be beneficial if most of the system queries are for the subset of the object, so un-needed attributes data would not have to be read, and the users do not have to setup every query for the given fetch group, as default one is always used. However, if queries on object are mostly use case specific and not systematic, using default fetch group could cause undesirable extra round-trip and performance degradation. | |
| setDescriptor | back to summary |
|---|---|
| public void setDescriptor(ClassDescriptor descriptor) Set the referenced descriptor. | |
| setObjectFetchGroup | back to summary |
|---|---|
| public void setObjectFetchGroup(Object source, FetchGroup fetchGroup, AbstractSession session) INTERNAL: Set fetch group into the object. | |
| setRefreshOnFetchGroupToObject | back to summary |
|---|---|
| public void setRefreshOnFetchGroupToObject(Object source, boolean shouldRefreshOnFetchgroup) INTERNAL: Set if the tracked object is fetched from executing a query with or without refresh. | |
| setShouldUseInheritedDefaultFetchGroup | back to summary |
|---|---|
| public void setShouldUseInheritedDefaultFetchGroup(boolean shouldUseInheritedDefaultFetchGroup) PUBLIC: Set whether defaultFetchGroup should be copied from the parent if not set. | |
| shouldUseInheritedDefaultFetchGroup | back to summary |
|---|---|
| public boolean shouldUseInheritedDefaultFetchGroup() PUBLIC: Indicates whether defaultFetchGroup should be copied from the parent if not set. | |
| shouldWriteInto | back to summary |
|---|---|
| public boolean shouldWriteInto(Object cachedObject, Object clone) INTERNAL: Return true if the cached object data should be written in clone. It is used in Fetch Group case when filling in the clone from the cached object. | |
| unionEntityFetchGroupIntoObject | back to summary |
|---|---|
| public void unionEntityFetchGroupIntoObject(Object source, EntityFetchGroup newEntityFetchGroup, AbstractSession session, boolean shouldClone) INTERNAL: Union the fetch group of the domain object with the new fetch group. | |
| unionFetchGroups | back to summary |
|---|---|
| public FetchGroup unionFetchGroups(FetchGroup first, FetchGroup second) INTERNAL: Union two fetch groups. | |
| writePartialIntoClones | back to summary |
|---|---|
| public void writePartialIntoClones(Object partialObject, Object workingClone, Object backupClone, UnitOfWorkImpl uow) INTERNAL: Write data of the partially fetched object into the working and backup clones | |