Package org.apache.openjpa.persistence
Interface FetchPlan
-
- All Known Subinterfaces:
JDBCFetchPlan
- All Known Implementing Classes:
FetchPlanImpl,JDBCFetchPlanImpl
public interface FetchPlanThe 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
Fields Modifier and Type Field Description static intDEFAULTConstant to revert any setting to its default value.static intDEPTH_INFINITEInfinite fetch depth.static java.lang.StringGROUP_ALLFetch group representing all fields.static java.lang.StringGROUP_DEFAULTThe default fetch group.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description FetchPlanaddFetchGroup(java.lang.String group)Addsgroupto the set of fetch group to use when loading objects.FetchPlanaddFetchGroups(java.lang.String... groups)Addsgroupsto the set of fetch group names to use when loading objects.FetchPlanaddFetchGroups(java.util.Collection groups)Addsgroupsto the set of fetch group names to use when loading objects.FetchPlanaddField(java.lang.Class cls, java.lang.String field)Addsfieldto the set of field names to use when loading objects.FetchPlanaddField(java.lang.String field)Addsfieldto the set of fully-qualified field names to use when loading objects.FetchPlanaddFields(java.lang.Class cls, java.lang.String... fields)Addsfieldsto the set of field names to use when loading objects.FetchPlanaddFields(java.lang.Class cls, java.util.Collection fields)Addsfieldsto the set of field names to use when loading objects.FetchPlanaddFields(java.lang.String... fields)Addsfieldsto the set of fully-qualified field names to use when loading objects.FetchPlanaddFields(java.util.Collection fields)Addsfieldsto the set of fully-qualified field names to use when loading objects.FetchPlanclearFetchGroups()Clears the set of fetch group names to use wen loading data.FetchPlanclearFields()Clears the set of field names to use wen loading data.DataCacheRetrieveModegetCacheRetrieveMode()Gets the current retrieve mode for data cache.DataCacheStoreModegetCacheStoreMode()Gets the current storage mode for data cache.FetchConfigurationgetDelegate()Deprecated.cast toFetchPlanImplinstead.booleangetExtendedPathLookup()Affirms if extended path lookup feature is active.intgetFetchBatchSize()Return the fetch batch size for large result set support.java.util.Collection<java.lang.String>getFetchGroups()Returns the names of the fetch groups that this component will use when loading objects.java.util.Collection<java.lang.String>getFields()Returns the fully qualified names of the fields that this component will use when loading objects.java.lang.ObjectgetHint(java.lang.String key)Get the hint value for the given key.java.util.Map<java.lang.String,java.lang.Object>getHints()Get the hints and their values currently set on this receiver.jakarta.persistence.PessimisticLockScopegetLockScope()The lock scope to use for locking loaded objects.intgetLockTimeout()The number of milliseconds to wait for an object lock, or -1 for no limit.intgetMaxFetchDepth()The maximum fetch depth when loading an object.booleangetQueryResultCache()Deprecated.usegetQueryResultCacheEnabled()instead.booleangetQueryResultCacheEnabled()Return whether or not query caching is enabled.intgetQueryTimeout()The number of milliseconds to wait for a query, or -1 for no limit.jakarta.persistence.LockModeTypegetReadLockMode()The lock level to use for locking loaded objects.jakarta.persistence.LockModeTypegetWriteLockMode()The lock level to use for locking dirtied objects.booleanhasField(java.lang.Class cls, java.lang.String field)Return true if the given field has been added.booleanhasField(java.lang.String field)Return true if the given field has been added.FetchPlanremoveFetchGroup(java.lang.String group)Remove the given fetch group.FetchPlanremoveFetchGroups(java.lang.String... groups)Removesgroupsfrom the set of fetch group names to use when loading objects.FetchPlanremoveFetchGroups(java.util.Collection groups)Removesgroupsfrom the set of fetch group names to use when loading objects.FetchPlanremoveField(java.lang.Class cls, java.lang.String field)Remove the given field.FetchPlanremoveField(java.lang.String field)Remove the given fully-qualified field.FetchPlanremoveFields(java.lang.Class cls, java.lang.String... fields)Removesfieldsfrom the set of field names to use when loading objects.FetchPlanremoveFields(java.lang.Class cls, java.util.Collection fields)Removesfieldsfrom the set of field names to use when loading objects.FetchPlanremoveFields(java.lang.String... fields)Removesfieldsfrom the set of fully-qualified field names to use when loading objects.FetchPlanremoveFields(java.util.Collection fields)Removesfieldsfrom the set of fully-qualified field names to use when loading objects.FetchPlanresetFetchGroups()Resets the set of fetch groups to the list in the global configuration.FetchPlansetCacheRetrieveMode(DataCacheRetrieveMode mode)Sets the current retrieve mode for data cache.FetchPlansetCacheStoreMode(DataCacheStoreMode mode)Sets the current storage mode for data cache.FetchPlansetExtendedPathLookup(boolean flag)Sets extended path lookup feature.FetchPlansetFetchBatchSize(int fetchBatchSize)Set the fetch batch size for large result set support.voidsetHint(java.lang.String key, java.lang.Object value)Set the hint for the given key to the given value.FetchPlansetLockScope(jakarta.persistence.PessimisticLockScope scope)The lock scope to use for locking loaded objects.FetchPlansetLockTimeout(int timeout)The number of milliseconds to wait for an object lock, or -1 for no limit.FetchPlansetMaxFetchDepth(int depth)The maximum fetch depth when loading an object.FetchPlansetQueryResultCache(boolean cache)Deprecated.usesetQueryResultCacheEnabled(boolean)instead.FetchPlansetQueryResultCacheEnabled(boolean cache)Control whether or not query caching is enabled.FetchPlansetQueryTimeout(int timeout)The number of milliseconds to wait for a query, or -1 for no limit.FetchPlansetReadLockMode(jakarta.persistence.LockModeType mode)The lock level to use for locking loaded objects.FetchPlansetWriteLockMode(jakarta.persistence.LockModeType mode)The lock level to use for locking dirtied objects.
-
-
-
Field Detail
-
GROUP_ALL
static final java.lang.String GROUP_ALL
Fetch group representing all fields.- See Also:
- Constant Field Values
-
GROUP_DEFAULT
static final java.lang.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 theopenjpa.FetchBatchSizesetting. 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 theopenjpa.FetchBatchSizesetting. Note that this property will be ignored under some data stores.
-
getQueryResultCacheEnabled
boolean getQueryResultCacheEnabled()
Return whether or not query caching is enabled. If this returnstruebut the datacache plugin is not installed, caching will not be enabled. If this returnsfalse, 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
-
getQueryResultCache
@Deprecated boolean getQueryResultCache()
Deprecated.usegetQueryResultCacheEnabled()instead.
-
setQueryResultCache
@Deprecated FetchPlan setQueryResultCache(boolean cache)
Deprecated.usesetQueryResultCacheEnabled(boolean)instead.
-
getFetchGroups
java.util.Collection<java.lang.String> getFetchGroups()
Returns the names of the fetch groups that this component will use when loading objects. Defaults to theopenjpa.FetchGroupssetting.
-
addFetchGroup
FetchPlan addFetchGroup(java.lang.String group)
Addsgroupto the set of fetch group to use when loading objects.
-
addFetchGroups
FetchPlan addFetchGroups(java.lang.String... groups)
Addsgroupsto the set of fetch group names to use when loading objects.
-
addFetchGroups
FetchPlan addFetchGroups(java.util.Collection groups)
Addsgroupsto the set of fetch group names to use when loading objects.
-
removeFetchGroup
FetchPlan removeFetchGroup(java.lang.String group)
Remove the given fetch group.
-
removeFetchGroups
FetchPlan removeFetchGroups(java.lang.String... groups)
Removesgroupsfrom the set of fetch group names to use when loading objects.
-
removeFetchGroups
FetchPlan removeFetchGroups(java.util.Collection groups)
Removesgroupsfrom 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
java.util.Collection<java.lang.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(java.lang.String field)
Return true if the given field has been added.
-
hasField
boolean hasField(java.lang.Class cls, java.lang.String field)Return true if the given field has been added.
-
addField
FetchPlan addField(java.lang.String field)
Addsfieldto the set of fully-qualified field names to use when loading objects.
-
addField
FetchPlan addField(java.lang.Class cls, java.lang.String field)
Addsfieldto the set of field names to use when loading objects.
-
addFields
FetchPlan addFields(java.lang.String... fields)
Addsfieldsto the set of fully-qualified field names to use when loading objects.
-
addFields
FetchPlan addFields(java.lang.Class cls, java.lang.String... fields)
Addsfieldsto the set of field names to use when loading objects.
-
addFields
FetchPlan addFields(java.util.Collection fields)
Addsfieldsto the set of fully-qualified field names to use when loading objects.
-
addFields
FetchPlan addFields(java.lang.Class cls, java.util.Collection fields)
Addsfieldsto the set of field names to use when loading objects.
-
removeField
FetchPlan removeField(java.lang.String field)
Remove the given fully-qualified field.
-
removeField
FetchPlan removeField(java.lang.Class cls, java.lang.String field)
Remove the given field.
-
removeFields
FetchPlan removeFields(java.lang.String... fields)
Removesfieldsfrom the set of fully-qualified field names to use when loading objects.
-
removeFields
FetchPlan removeFields(java.lang.Class cls, java.lang.String... fields)
Removesfieldsfrom the set of field names to use when loading objects.
-
removeFields
FetchPlan removeFields(java.util.Collection fields)
Removesfieldsfrom the set of fully-qualified field names to use when loading objects.
-
removeFields
FetchPlan removeFields(java.lang.Class cls, java.util.Collection fields)
Removesfieldsfrom 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.
-
getLockScope
jakarta.persistence.PessimisticLockScope getLockScope()
The lock scope to use for locking loaded objects.
-
setLockScope
FetchPlan setLockScope(jakarta.persistence.PessimisticLockScope scope)
The lock scope to use for locking loaded objects.
-
getQueryTimeout
int getQueryTimeout()
The number of milliseconds to wait for a query, or -1 for no limit.
-
setQueryTimeout
FetchPlan setQueryTimeout(int timeout)
The number of milliseconds to wait for a query, or -1 for no limit.
-
getReadLockMode
jakarta.persistence.LockModeType getReadLockMode()
The lock level to use for locking loaded objects.
-
setReadLockMode
FetchPlan setReadLockMode(jakarta.persistence.LockModeType mode)
The lock level to use for locking loaded objects.
-
getWriteLockMode
jakarta.persistence.LockModeType getWriteLockMode()
The lock level to use for locking dirtied objects.
-
setWriteLockMode
FetchPlan setWriteLockMode(jakarta.persistence.LockModeType mode)
The lock level to use for locking dirtied objects.
-
getDelegate
@Deprecated FetchConfiguration getDelegate()
Deprecated.cast toFetchPlanImplinstead. This method pierces the published-API boundary, as does the SPI cast.
-
getExtendedPathLookup
boolean getExtendedPathLookup()
Affirms if extended path lookup feature is active.- Since:
- 2.0.0
-
setExtendedPathLookup
FetchPlan setExtendedPathLookup(boolean flag)
Sets extended path lookup feature.- Since:
- 2.0.0
-
getCacheStoreMode
DataCacheStoreMode getCacheStoreMode()
Gets the current storage mode for data cache.- Since:
- 2.0.0
-
setCacheStoreMode
FetchPlan setCacheStoreMode(DataCacheStoreMode mode)
Sets the current storage mode for data cache.- Since:
- 2.0.0
-
getCacheRetrieveMode
DataCacheRetrieveMode getCacheRetrieveMode()
Gets the current retrieve mode for data cache.- Since:
- 2.0.0
-
setCacheRetrieveMode
FetchPlan setCacheRetrieveMode(DataCacheRetrieveMode mode)
Sets the current retrieve mode for data cache.- Since:
- 2.0.0
-
setHint
void setHint(java.lang.String key, java.lang.Object value)Set the hint for the given key to the given value.- Parameters:
value- the value of the hint.name- the name of the hint.- Since:
- 2.0.0
-
getHints
java.util.Map<java.lang.String,java.lang.Object> getHints()
Get the hints and their values currently set on this receiver.- Returns:
- empty map if no hint has been set.
-
getHint
java.lang.Object getHint(java.lang.String key)
Get the hint value for the given key.- Returns:
- null if the key has not been set.
-
-