Package javax.jdo
Interface FetchPlan
-
public interface FetchPlanFetch groups are activated using methods on this interface. An instance of this interface can be obtained fromPersistenceManager.getFetchPlan(),Extent.getFetchPlan(), andQuery.getFetchPlan(). When aQueryorExtentis retrieved from aPersistenceManager, itsFetchPlanis initialized to the same settings as that of thePersistenceManager. Subsequent modifications of theQueryorExtent'sFetchPlanare not reflected in theFetchPlanof thePersistenceManager.- Since:
- 2.0
- Version:
- 2.0
-
-
Field Summary
Fields Modifier and Type Field Description static StringALLFor use withaddGroup(java.lang.String),removeGroup(java.lang.String), and the varioussetGroups(java.util.Collection)calls.static StringDEFAULTFor use withaddGroup(java.lang.String),removeGroup(java.lang.String), and the varioussetGroups(java.util.Collection)calls.static intDETACH_LOAD_FIELDSFor use withPersistenceManager.detachCopy(T)andsetDetachmentOptions(int).static intDETACH_UNLOAD_FIELDSFor use withPersistenceManager.detachCopy(T)andsetDetachmentOptions(int).static intFETCH_SIZE_GREEDYFor use withsetFetchSize(int).static intFETCH_SIZE_OPTIMALFor use withsetFetchSize(int).
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description FetchPlanaddGroup(String fetchGroupName)Add the fetch group to the set of active fetch groups.FetchPlanclearGroups()Remove all active groups leaving no active fetch group.intgetDetachmentOptions()Get options used during detachment.Class[]getDetachmentRootClasses()Get the root classes for DetachAllOnCommit.CollectiongetDetachmentRoots()Get the roots for DetachAllOnCommit.intgetFetchSize()Return the fetch size, orFETCH_SIZE_OPTIMALif not set, orFETCH_SIZE_GREEDYto fetch all.SetgetGroups()Return an immutable Set containing the names of all active fetch groups.intgetMaxFetchDepth()Return the maximum fetch depth used when fetching instances.FetchPlanremoveGroup(String fetchGroupName)Remove the fetch group from the set active fetch groups.FetchPlansetDetachmentOptions(int options)Set options to be used during detachment.FetchPlansetDetachmentRootClasses(Class... rootClasses)Set the root classes for DetachAllOnCommit.FetchPlansetDetachmentRoots(Collection roots)Set the roots for DetachAllOnCommit.FetchPlansetFetchSize(int fetchSize)Set the fetch size for large result set support.FetchPlansetGroup(String fetchGroupName)Set the active fetch groups to the single named fetch group.FetchPlansetGroups(String... fetchGroupNames)Set a collection of groups.FetchPlansetGroups(Collection fetchGroupNames)Set a collection of groups.FetchPlansetMaxFetchDepth(int fetchDepth)Set the maximum fetch depth when fetching.
-
-
-
Field Detail
-
DEFAULT
static final String DEFAULT
For use withaddGroup(java.lang.String),removeGroup(java.lang.String), and the varioussetGroups(java.util.Collection)calls. Value:default.- Since:
- 2.0
- See Also:
- Constant Field Values
-
ALL
static final String ALL
For use withaddGroup(java.lang.String),removeGroup(java.lang.String), and the varioussetGroups(java.util.Collection)calls. Value:all.- Since:
- 2.0
- See Also:
- Constant Field Values
-
DETACH_UNLOAD_FIELDS
static final int DETACH_UNLOAD_FIELDS
For 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:
- Constant Field Values
-
DETACH_LOAD_FIELDS
static final int DETACH_LOAD_FIELDS
For 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:
- Constant Field Values
-
FETCH_SIZE_GREEDY
static final int FETCH_SIZE_GREEDY
For use withsetFetchSize(int). Value: -1.- Since:
- 2.0
- See Also:
- Constant Field Values
-
FETCH_SIZE_OPTIMAL
static final int FETCH_SIZE_OPTIMAL
For use withsetFetchSize(int). Value: 0.- Since:
- 2.0
- See Also:
- Constant Field Values
-
-
Method Detail
-
addGroup
FetchPlan addGroup(String fetchGroupName)
Add the fetch group to the set of active fetch groups.- Parameters:
fetchGroupName- Name of the FetchGroup to add- Returns:
- the FetchPlan
- Since:
- 2.0
-
removeGroup
FetchPlan removeGroup(String fetchGroupName)
Remove the fetch group from the set active fetch groups.- Parameters:
fetchGroupName- Name of the FetchGroup to remove- Returns:
- the FetchPlan
- Since:
- 2.0
-
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
FetchPlan setGroups(Collection fetchGroupNames)
Set a collection of groups.- Parameters:
fetchGroupNames- a collection of names of fetch groups- Returns:
- the FetchPlan
- Since:
- 2.0
-
setGroups
FetchPlan setGroups(String... fetchGroupNames)
Set a collection of groups.- Parameters:
fetchGroupNames- a String array of names of fetch groups- Returns:
- the FetchPlan
- Since:
- 2.0
-
setGroup
FetchPlan setGroup(String fetchGroupName)
Set the active fetch groups to the single named fetch group.- Parameters:
fetchGroupName- the single fetch group- Returns:
- the FetchPlan
- Since:
- 2.0
-
setMaxFetchDepth
FetchPlan setMaxFetchDepth(int fetchDepth)
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
FetchPlan setDetachmentRoots(Collection roots)
Set the roots for DetachAllOnCommit.- Parameters:
roots- Collection of the detachment roots.- Returns:
- This FetchPlan
- Since:
- 2.0
-
getDetachmentRoots
Collection getDetachmentRoots()
Get the roots for DetachAllOnCommit.- Returns:
- Collection of detachment roots.
- Since:
- 2.0
-
setDetachmentRootClasses
FetchPlan setDetachmentRootClasses(Class... rootClasses)
Set the root classes for DetachAllOnCommit.- Parameters:
rootClasses- The root classes.- Returns:
- This FetchPlan
- Since:
- 2.0
-
getDetachmentRootClasses
Class[] getDetachmentRootClasses()
Get the root classes for DetachAllOnCommit.- Returns:
- The detachment root classes
- Since:
- 2.0
-
setFetchSize
FetchPlan setFetchSize(int fetchSize)
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
FetchPlan setDetachmentOptions(int options)
Set options to be used during detachment. Options areDETACH_LOAD_FIELDSandDETACH_UNLOAD_FIELDS.- Parameters:
options- Options for use during detachment.- Returns:
- This FetchPlan
-
getDetachmentOptions
int getDetachmentOptions()
Get options used during detachment.- Returns:
- Options to use during detachment.
-
-