Interface FetchPlan
public interface FetchPlan
Fetch groups are activated using methods on this interface. An
instance of this interface can be obtained from
PersistenceManager.getFetchPlan(), Extent.getFetchPlan(), and
Query.getFetchPlan(). When a Query or
Extent is retrieved from a
PersistenceManager, its FetchPlan is
initialized to the same settings as that of the
PersistenceManager. Subsequent modifications of the
Query or Extent's FetchPlan
are not reflected in the FetchPlan of the
PersistenceManager.- Since:
- 2.0
- Version:
- 2.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final intFor use withPersistenceManager.detachCopy(T)andsetDetachmentOptions(int).static final intFor use withPersistenceManager.detachCopy(T)andsetDetachmentOptions(int).static final intFor use withsetFetchSize(int).static final intFor use withsetFetchSize(int). -
Method Summary
Modifier and TypeMethodDescriptionAdd the fetch group to the set of active fetch groups.Remove all active groups leaving no active fetch group.intGet options used during detachment.Class[]Get the root classes for DetachAllOnCommit.Get the roots for DetachAllOnCommit.intReturn the fetch size, orFETCH_SIZE_OPTIMALif not set, orFETCH_SIZE_GREEDYto fetch all.Return an immutable Set containing the names of all active fetch groups.intReturn the maximum fetch depth used when fetching instances.removeGroup(String fetchGroupName) Remove the fetch group from the set active fetch groups.setDetachmentOptions(int options) Set options to be used during detachment.setDetachmentRootClasses(Class... rootClasses) Set the root classes for DetachAllOnCommit.setDetachmentRoots(Collection roots) Set the roots for DetachAllOnCommit.setFetchSize(int fetchSize) Set the fetch size for large result set support.Set the active fetch groups to the single named fetch group.Set a collection of groups.setGroups(Collection fetchGroupNames) Set a collection of groups.setMaxFetchDepth(int fetchDepth) Set the maximum fetch depth when fetching.
-
Field Details
-
DEFAULT
For use withaddGroup(String),removeGroup(String), and the varioussetGroups(Collection)calls. Value:default.- Since:
- 2.0
- See Also:
-
ALL
For use withaddGroup(String),removeGroup(String), and the varioussetGroups(Collection)calls. Value:all.- Since:
- 2.0
- See Also:
-
DETACH_UNLOAD_FIELDS
static final int DETACH_UNLOAD_FIELDSFor use withPersistenceManager.detachCopy(T)andsetDetachmentOptions(int). Specifies that fields that are loaded but not in the current fetch plan should be unloaded prior to detachment.- Since:
- 2.0
- See Also:
-
DETACH_LOAD_FIELDS
static final int DETACH_LOAD_FIELDSFor use withPersistenceManager.detachCopy(T)andsetDetachmentOptions(int). Specifies that fields that are not loaded but are in the current fetch plan should be loaded prior to detachment.- Since:
- 2.0
- See Also:
-
FETCH_SIZE_GREEDY
-
FETCH_SIZE_OPTIMAL
-
-
Method Details
-
addGroup
-
removeGroup
-
clearGroups
FetchPlan clearGroups()Remove all active groups leaving no active fetch group.- Returns:
- the FetchPlan
- Since:
- 2.0
-
getGroups
Set getGroups()Return an immutable Set containing the names of all active fetch groups. The Set is a copy of the currently active groups and will not change based on subsequent changes to the groups.- Returns:
- an immutable Set containing the names of all currently active fetch groups
- Since:
- 2.0
-
setGroups
Set a collection of groups.- Parameters:
fetchGroupNames- a collection of names of fetch groups- Returns:
- the FetchPlan
- Since:
- 2.0
-
setGroups
-
setGroup
-
setMaxFetchDepth
Set the maximum fetch depth when fetching. A value of 0 has no meaning and will throw a JDOUserException. A value of -1 means that no limit is placed on fetching. A positive integer will result in that number of references from the initial object to be fetched.- Parameters:
fetchDepth- the depth- Returns:
- the FetchPlan
- Since:
- 2.0
-
getMaxFetchDepth
int getMaxFetchDepth()Return the maximum fetch depth used when fetching instances.- Returns:
- the maximum fetch depth
- Since:
- 2.0
-
setDetachmentRoots
Set the roots for DetachAllOnCommit.- Parameters:
roots- Collection of the detachment roots.- Since:
- 2.0
-
getDetachmentRoots
Collection getDetachmentRoots()Get the roots for DetachAllOnCommit.- Returns:
- Collection of detachment roots.
- Since:
- 2.0
-
setDetachmentRootClasses
-
getDetachmentRootClasses
Class[] getDetachmentRootClasses()Get the root classes for DetachAllOnCommit.- Returns:
- The detachment root classes
- Since:
- 2.0
-
setFetchSize
Set the fetch size for large result set support. UseFETCH_SIZE_OPTIMALto unset, andFETCH_SIZE_GREEDYto force loading of everything.- Parameters:
fetchSize- the fetch size- Returns:
- the FetchPlan
- Since:
- 2.0
-
getFetchSize
int getFetchSize()Return the fetch size, orFETCH_SIZE_OPTIMALif not set, orFETCH_SIZE_GREEDYto fetch all.- Returns:
- the fetch size
- Since:
- 2.0
-
setDetachmentOptions
Set options to be used during detachment. Options areDETACH_LOAD_FIELDSandDETACH_UNLOAD_FIELDS. -
getDetachmentOptions
int getDetachmentOptions()Get options used during detachment.
-