org.apache.openjpa.persistence
Interface FetchPlan

All Known Subinterfaces:
JDBCFetchPlan
All Known Implementing Classes:
FetchPlanImpl, JDBCFetchPlanImpl

public interface FetchPlan

The fetch plan allows you to dynamically alter eager fetching configuration and other aspects of data loading.

Since:
0.4.1
Author:
Abe White, Pinaki Poddar

Field Summary
static int DEFAULT
          Constant to revert any setting to its default value.
static int DEPTH_INFINITE
          Infinite fetch depth.
static String GROUP_ALL
          Fetch group representing all fields.
static String GROUP_DEFAULT
          The default fetch group.
 
Method Summary
 FetchPlan addFetchGroup(String group)
          Adds group to the set of fetch group to use when loading objects.
 FetchPlan addFetchGroups(Collection groups)
          Adds groups to the set of fetch group names to use when loading objects.
 FetchPlan addFetchGroups(String... groups)
          Adds groups to the set of fetch group names to use when loading objects.
 FetchPlan addField(Class cls, String field)
          Adds field to the set of field names to use when loading objects.
 FetchPlan addField(String field)
          Adds field to the set of fully-qualified field names to use when loading objects.
 FetchPlan addFields(Class cls, Collection fields)
          Adds fields to the set of field names to use when loading objects.
 FetchPlan addFields(Class cls, String... fields)
          Adds fields to the set of field names to use when loading objects.
 FetchPlan addFields(Collection fields)
          Adds fields to the set of fully-qualified field names to use when loading objects.
 FetchPlan addFields(String... fields)
          Adds fields to the set of fully-qualified field names to use when loading objects.
 FetchPlan clearFetchGroups()
          Clears the set of fetch group names to use wen loading data.
 FetchPlan clearFields()
          Clears the set of field names to use wen loading data.
 int getFetchBatchSize()
          Return the fetch batch size for large result set support.
 Collection<String> getFetchGroups()
          Returns the names of the fetch groups that this component will use when loading objects.
 Collection<String> getFields()
          Returns the fully qualified names of the fields that this component will use when loading objects.
 int getLockTimeout()
          The number of milliseconds to wait for an object lock, or -1 for no limit.
 int getMaxFetchDepth()
          The maximum fetch depth when loading an object.
 boolean getQueryResultCacheEnabled()
          Return whether or not query caching is enabled.
 LockModeType getReadLockMode()
          The lock level to use for locking loaded objects.
 LockModeType getWriteLockMode()
          The lock level to use for locking dirtied objects.
 boolean hasField(Class cls, String field)
          Return true if the given field has been added.
 boolean hasField(String field)
          Return true if the given field has been added.
 FetchPlan removeFetchGroup(String group)
          Remove the given fetch group.
 FetchPlan removeFetchGroups(Collection groups)
          Removes groups from the set of fetch group names to use when loading objects.
 FetchPlan removeFetchGroups(String... groups)
          Removes groups from the set of fetch group names to use when loading objects.
 FetchPlan removeField(Class cls, String field)
          Remove the given field.
 FetchPlan removeField(String field)
          Remove the given fully-qualified field.
 FetchPlan removeFields(Class cls, Collection fields)
          Removes fields from the set of field names to use when loading objects.
 FetchPlan removeFields(Class cls, String... fields)
          Removes fields from the set of field names to use when loading objects.
 FetchPlan removeFields(Collection fields)
          Removes fields from the set of fully-qualified field names to use when loading objects.
 FetchPlan removeFields(String... fields)
          Removes fields from the set of fully-qualified field names to use when loading objects.
 FetchPlan resetFetchGroups()
          Resets the set of fetch groups to the list in the global configuration.
 FetchPlan setFetchBatchSize(int fetchBatchSize)
          Set the fetch batch size for large result set support.
 FetchPlan setLockTimeout(int timeout)
          The number of milliseconds to wait for an object lock, or -1 for no limit.
 FetchPlan setMaxFetchDepth(int depth)
          The maximum fetch depth when loading an object.
 FetchPlan setQueryResultCacheEnabled(boolean cache)
          Control whether or not query caching is enabled.
 FetchPlan setReadLockMode(LockModeType mode)
          The lock level to use for locking loaded objects.
 FetchPlan setWriteLockMode(LockModeType mode)
          The lock level to use for locking dirtied objects.
 

Field Detail

GROUP_ALL

static final String GROUP_ALL
Fetch group representing all fields.

See Also:
Constant Field Values

GROUP_DEFAULT

static final String GROUP_DEFAULT
The default fetch group.

See Also:
Constant Field Values

DEPTH_INFINITE

static final int DEPTH_INFINITE
Infinite fetch depth.

See Also:
Constant Field Values

DEFAULT

static final int DEFAULT
Constant to revert any setting to its default value.

See Also:
Constant Field Values
Method Detail

getMaxFetchDepth

int getMaxFetchDepth()
The maximum fetch depth when loading an object.


setMaxFetchDepth

FetchPlan setMaxFetchDepth(int depth)
The maximum fetch depth when loading an object.


getFetchBatchSize

int getFetchBatchSize()
Return the fetch batch size for large result set support. Defaults to the openjpa.FetchBatchSize setting. Note that this property will be ignored under some data stores.


setFetchBatchSize

FetchPlan setFetchBatchSize(int fetchBatchSize)
Set the fetch batch size for large result set support. Defaults to the openjpa.FetchBatchSize setting. Note that this property will be ignored under some data stores.


getQueryResultCacheEnabled

boolean getQueryResultCacheEnabled()
Return whether or not query caching is enabled. If this returns true but the datacache plugin is not installed, caching will not be enabled. If this returns false, query caching will not be used even if the datacache plugin is installed.

Since:
1.0.0

setQueryResultCacheEnabled

FetchPlan setQueryResultCacheEnabled(boolean cache)
Control whether or not query caching is enabled. This has no effect if the datacache plugin is not installed, or if the query cache size is set to zero.

Since:
1.0.0

getFetchGroups

Collection<String> getFetchGroups()
Returns the names of the fetch groups that this component will use when loading objects. Defaults to the openjpa.FetchGroups setting.


addFetchGroup

FetchPlan addFetchGroup(String group)
Adds group to the set of fetch group to use when loading objects.


addFetchGroups

FetchPlan addFetchGroups(String... groups)
Adds groups to the set of fetch group names to use when loading objects.


addFetchGroups

FetchPlan addFetchGroups(Collection groups)
Adds groups to the set of fetch group names to use when loading objects.


removeFetchGroup

FetchPlan removeFetchGroup(String group)
Remove the given fetch group.


removeFetchGroups

FetchPlan removeFetchGroups(String... groups)
Removes groups from the set of fetch group names to use when loading objects.


removeFetchGroups

FetchPlan removeFetchGroups(Collection groups)
Removes groups from the set of fetch group names to use when loading objects.


clearFetchGroups

FetchPlan clearFetchGroups()
Clears the set of fetch group names to use wen loading data. After this operation is invoked, only those fields in the default fetch group (and any requested field) will be loaded when loading an object.


resetFetchGroups

FetchPlan resetFetchGroups()
Resets the set of fetch groups to the list in the global configuration.


getFields

Collection<String> getFields()
Returns the fully qualified names of the fields that this component will use when loading objects. Defaults to the empty set.


hasField

boolean hasField(String field)
Return true if the given field has been added.


hasField

boolean hasField(Class cls,
                 String field)
Return true if the given field has been added.


addField

FetchPlan addField(String field)
Adds field to the set of fully-qualified field names to use when loading objects.


addField

FetchPlan addField(Class cls,
                   String field)
Adds field to the set of field names to use when loading objects.


addFields

FetchPlan addFields(String... fields)
Adds fields to the set of fully-qualified field names to use when loading objects.


addFields

FetchPlan addFields(Class cls,
                    String... fields)
Adds fields to the set of field names to use when loading objects.


addFields

FetchPlan addFields(Collection fields)
Adds fields to the set of fully-qualified field names to use when loading objects.


addFields

FetchPlan addFields(Class cls,
                    Collection fields)
Adds fields to the set of field names to use when loading objects.


removeField

FetchPlan removeField(String field)
Remove the given fully-qualified field.


removeField

FetchPlan removeField(Class cls,
                      String field)
Remove the given field.


removeFields

FetchPlan removeFields(String... fields)
Removes fields from the set of fully-qualified field names to use when loading objects.


removeFields

FetchPlan removeFields(Class cls,
                       String... fields)
Removes fields from the set of field names to use when loading objects.


removeFields

FetchPlan removeFields(Collection fields)
Removes fields from the set of fully-qualified field names to use when loading objects.


removeFields

FetchPlan removeFields(Class cls,
                       Collection fields)
Removes fields from the set of field names to use when loading objects.


clearFields

FetchPlan clearFields()
Clears the set of field names to use wen loading data. After this operation is invoked, only those fields in the configured fetch groups will be loaded when loading an object.


getLockTimeout

int getLockTimeout()
The number of milliseconds to wait for an object lock, or -1 for no limit.


setLockTimeout

FetchPlan setLockTimeout(int timeout)
The number of milliseconds to wait for an object lock, or -1 for no limit.


getReadLockMode

LockModeType getReadLockMode()
The lock level to use for locking loaded objects.


setReadLockMode

FetchPlan setReadLockMode(LockModeType mode)
The lock level to use for locking loaded objects.


getWriteLockMode

LockModeType getWriteLockMode()
The lock level to use for locking dirtied objects.


setWriteLockMode

FetchPlan setWriteLockMode(LockModeType mode)
The lock level to use for locking dirtied objects.



Copyright © 2006-2007 Apache Software Foundation. All Rights Reserved.