FetchGroup represents a named fetch group for a specific class or interface. A fetch group instance identifies the name of the class or interface, the list of members (fields or properties) to be fetched when the fetch group is active, and the recursion depth for each member.
Fetch groups are updated using methods on this interface. An instance of a class implementing this interface can be obtained from {@link PersistenceManager#getFetchGroup} or{@link PersistenceManagerFactory#getFetchGroup}.
A FetchGroup can be unscoped or can be in one of two scopes (the {@link PersistenceManager} or the {@link PersistenceManagerFactory} scope). Unscoped FetchGroups do not affect any behavior. A FetchGroup in PersistenceManager scope hides the corresponding FetchGroup in the PersistenceManagerFactory scope.
- When a FetchGroup is obtained via {@link PersistenceManager#getFetchGroup}, it is immediately in scope of its
PersistenceManager
. Subsequent modifications of the FetchGroup immediately affect FetchPlan
s that contain the FetchGroup
. - When a FetchGroup is obtained via {@link PersistenceManagerFactory#getFetchGroup}, it is unscoped.
- When a FetchGroup is added to the set of active FetchGroups via {@link PersistenceManagerFactory#addFetchGroups}, it is put in scope of the
PersistenceManagerFactory
. - When a FetchGroup is removed from the set of active FetchGroups via {@link PersistenceManagerFactory#removeFetchGroups}, {@link PersistenceManagerFactory#removeAllFetchGroups}, or replaced via {@link PersistenceManagerFactory#addFetchGroups}, it is unscoped.
@version 2.2
@since 2.2