Package org.apache.openjpa.persistence
Class FetchPlanImpl
- java.lang.Object
-
- org.apache.openjpa.persistence.FetchPlanImpl
-
- All Implemented Interfaces:
FetchPlan
- Direct Known Subclasses:
JDBCFetchPlanImpl
public class FetchPlanImpl extends java.lang.Object implements FetchPlan
Implements FetchPlan via delegation to FetchConfiguration.- Since:
- 0.4.1
- Author:
- Abe White, Pinaki Poddar
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.util.Map<java.lang.String,HintValueConverter[]>
_hints
Structure holds one or more converters for a user-specified hint value.protected static java.util.Map<java.lang.String,java.util.List<java.lang.String>>
_precedence
Structure holds ranking of equivalent hint keys.-
Fields inherited from interface org.apache.openjpa.persistence.FetchPlan
DEFAULT, DEPTH_INFINITE, GROUP_ALL, GROUP_DEFAULT
-
-
Constructor Summary
Constructors Constructor Description FetchPlanImpl(FetchConfiguration fetch)
Constructor; supply delegate.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description FetchPlan
addFetchGroup(java.lang.String group)
Addsgroup
to the set of fetch group to use when loading objects.FetchPlan
addFetchGroups(java.lang.String... groups)
Addsgroups
to the set of fetch group names to use when loading objects.FetchPlan
addFetchGroups(java.util.Collection groups)
Addsgroups
to the set of fetch group names to use when loading objects.FetchPlan
addField(java.lang.Class cls, java.lang.String field)
Addsfield
to the set of field names to use when loading objects.FetchPlan
addField(java.lang.String field)
Addsfield
to the set of fully-qualified field names to use when loading objects.FetchPlan
addFields(java.lang.Class cls, java.lang.String... fields)
Addsfields
to the set of field names to use when loading objects.FetchPlan
addFields(java.lang.Class cls, java.util.Collection fields)
Addsfields
to the set of field names to use when loading objects.FetchPlan
addFields(java.lang.String... fields)
Addsfields
to the set of fully-qualified field names to use when loading objects.FetchPlan
addFields(java.util.Collection fields)
Addsfields
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.boolean
equals(java.lang.Object other)
DataCacheRetrieveMode
getCacheRetrieveMode()
Gets the current retrieve mode for data cache.DataCacheStoreMode
getCacheStoreMode()
Gets the current storage mode for data cache.FetchConfiguration
getDelegate()
Delegate.boolean
getExtendedPathLookup()
Affirms if extended path lookup feature is active.int
getFetchBatchSize()
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.Object
getHint(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.PessimisticLockScope
getLockScope()
The lock scope to use for locking loaded 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
getQueryResultCache()
boolean
getQueryResultCacheEnabled()
Return whether or not query caching is enabled.int
getQueryTimeout()
The number of milliseconds to wait for a query, or -1 for no limit.jakarta.persistence.LockModeType
getReadLockMode()
The lock level to use for locking loaded objects.jakarta.persistence.LockModeType
getWriteLockMode()
The lock level to use for locking dirtied objects.boolean
hasField(java.lang.Class cls, java.lang.String field)
Return true if the given field has been added.boolean
hasField(java.lang.String field)
Return true if the given field has been added.int
hashCode()
protected DelegatingFetchConfiguration
newDelegatingFetchConfiguration(FetchConfiguration fetch)
Create a new exception-translating delegating fetch configuration.protected static void
registerHint(java.lang.String[] keys, HintValueConverter... converters)
Registers a hint key with its value converters.FetchPlan
removeFetchGroup(java.lang.String group)
Remove the given fetch group.FetchPlan
removeFetchGroups(java.lang.String... groups)
Removesgroups
from the set of fetch group names to use when loading objects.FetchPlan
removeFetchGroups(java.util.Collection groups)
Removesgroups
from the set of fetch group names to use when loading objects.FetchPlan
removeField(java.lang.Class cls, java.lang.String field)
Remove the given field.FetchPlan
removeField(java.lang.String field)
Remove the given fully-qualified field.FetchPlan
removeFields(java.lang.Class cls, java.lang.String... fields)
Removesfields
from the set of field names to use when loading objects.FetchPlan
removeFields(java.lang.Class cls, java.util.Collection fields)
Removesfields
from the set of field names to use when loading objects.FetchPlan
removeFields(java.lang.String... fields)
Removesfields
from the set of fully-qualified field names to use when loading objects.FetchPlan
removeFields(java.util.Collection fields)
Removesfields
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
setCacheRetrieveMode(DataCacheRetrieveMode mode)
Sets the current retrieve mode for data cache.FetchPlan
setCacheStoreMode(DataCacheStoreMode mode)
Sets the current storage mode for data cache.FetchPlan
setExtendedPathLookup(boolean flag)
Sets extended path lookup feature.FetchPlan
setFetchBatchSize(int fetchBatchSize)
Set the fetch batch size for large result set support.void
setHint(java.lang.String key, java.lang.Object value)
Sets the hint after converting the value appropriately.void
setHints(java.util.Map<java.lang.String,java.lang.Object> hints)
FetchPlan
setLockScope(jakarta.persistence.PessimisticLockScope scope)
The lock scope to use for locking loaded objects.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
setQueryResultCache(boolean cache)
FetchPlan
setQueryResultCacheEnabled(boolean cache)
Control whether or not query caching is enabled.FetchPlan
setQueryTimeout(int timeout)
The number of milliseconds to wait for a query, or -1 for no limit.FetchPlan
setReadLockMode(jakarta.persistence.LockModeType mode)
The lock level to use for locking loaded objects.FetchPlan
setWriteLockMode(jakarta.persistence.LockModeType mode)
The lock level to use for locking dirtied objects.
-
-
-
Field Detail
-
_precedence
protected static java.util.Map<java.lang.String,java.util.List<java.lang.String>> _precedence
Structure holds ranking of equivalent hint keys. Each entry value is a list of other keys that are higher rank than the entry key.
-
_hints
protected static java.util.Map<java.lang.String,HintValueConverter[]> _hints
Structure holds one or more converters for a user-specified hint value.
-
-
Constructor Detail
-
FetchPlanImpl
public FetchPlanImpl(FetchConfiguration fetch)
Constructor; supply delegate.
-
-
Method Detail
-
registerHint
protected static void registerHint(java.lang.String[] keys, HintValueConverter... converters)
Registers a hint key with its value converters.- Parameters:
keys
- a set of keys in increasing order of ranking. Can not be null or empty.converters
- array of converters that are attempts in order to convert a user-specified hint value to a value that is consumable by the kernel.
-
newDelegatingFetchConfiguration
protected DelegatingFetchConfiguration newDelegatingFetchConfiguration(FetchConfiguration fetch)
Create a new exception-translating delegating fetch configuration.
-
getDelegate
public FetchConfiguration getDelegate()
Delegate.- Specified by:
getDelegate
in interfaceFetchPlan
-
getMaxFetchDepth
public int getMaxFetchDepth()
Description copied from interface:FetchPlan
The maximum fetch depth when loading an object.- Specified by:
getMaxFetchDepth
in interfaceFetchPlan
-
setMaxFetchDepth
public FetchPlan setMaxFetchDepth(int depth)
Description copied from interface:FetchPlan
The maximum fetch depth when loading an object.- Specified by:
setMaxFetchDepth
in interfaceFetchPlan
-
getFetchBatchSize
public int getFetchBatchSize()
Description copied from interface:FetchPlan
Return the fetch batch size for large result set support. Defaults to theopenjpa.FetchBatchSize
setting. Note that this property will be ignored under some data stores.- Specified by:
getFetchBatchSize
in interfaceFetchPlan
-
setFetchBatchSize
public FetchPlan setFetchBatchSize(int fetchBatchSize)
Description copied from interface:FetchPlan
Set the fetch batch size for large result set support. Defaults to theopenjpa.FetchBatchSize
setting. Note that this property will be ignored under some data stores.- Specified by:
setFetchBatchSize
in interfaceFetchPlan
-
getQueryResultCacheEnabled
public boolean getQueryResultCacheEnabled()
Description copied from interface:FetchPlan
Return whether or not query caching is enabled. If this returnstrue
but 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.- Specified by:
getQueryResultCacheEnabled
in interfaceFetchPlan
-
setQueryResultCacheEnabled
public FetchPlan setQueryResultCacheEnabled(boolean cache)
Description copied from interface:FetchPlan
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.- Specified by:
setQueryResultCacheEnabled
in interfaceFetchPlan
-
getQueryResultCache
public boolean getQueryResultCache()
- Specified by:
getQueryResultCache
in interfaceFetchPlan
-
setQueryResultCache
public FetchPlan setQueryResultCache(boolean cache)
- Specified by:
setQueryResultCache
in interfaceFetchPlan
-
getFetchGroups
public java.util.Collection<java.lang.String> getFetchGroups()
Description copied from interface:FetchPlan
Returns the names of the fetch groups that this component will use when loading objects. Defaults to theopenjpa.FetchGroups
setting.- Specified by:
getFetchGroups
in interfaceFetchPlan
-
addFetchGroup
public FetchPlan addFetchGroup(java.lang.String group)
Description copied from interface:FetchPlan
Addsgroup
to the set of fetch group to use when loading objects.- Specified by:
addFetchGroup
in interfaceFetchPlan
-
addFetchGroups
public FetchPlan addFetchGroups(java.lang.String... groups)
Description copied from interface:FetchPlan
Addsgroups
to the set of fetch group names to use when loading objects.- Specified by:
addFetchGroups
in interfaceFetchPlan
-
addFetchGroups
public FetchPlan addFetchGroups(java.util.Collection groups)
Description copied from interface:FetchPlan
Addsgroups
to the set of fetch group names to use when loading objects.- Specified by:
addFetchGroups
in interfaceFetchPlan
-
removeFetchGroup
public FetchPlan removeFetchGroup(java.lang.String group)
Description copied from interface:FetchPlan
Remove the given fetch group.- Specified by:
removeFetchGroup
in interfaceFetchPlan
-
removeFetchGroups
public FetchPlan removeFetchGroups(java.lang.String... groups)
Description copied from interface:FetchPlan
Removesgroups
from the set of fetch group names to use when loading objects.- Specified by:
removeFetchGroups
in interfaceFetchPlan
-
removeFetchGroups
public FetchPlan removeFetchGroups(java.util.Collection groups)
Description copied from interface:FetchPlan
Removesgroups
from the set of fetch group names to use when loading objects.- Specified by:
removeFetchGroups
in interfaceFetchPlan
-
clearFetchGroups
public FetchPlan clearFetchGroups()
Description copied from interface:FetchPlan
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.- Specified by:
clearFetchGroups
in interfaceFetchPlan
-
resetFetchGroups
public FetchPlan resetFetchGroups()
Description copied from interface:FetchPlan
Resets the set of fetch groups to the list in the global configuration.- Specified by:
resetFetchGroups
in interfaceFetchPlan
-
getFields
public java.util.Collection<java.lang.String> getFields()
Description copied from interface:FetchPlan
Returns the fully qualified names of the fields that this component will use when loading objects. Defaults to the empty set.
-
hasField
public boolean hasField(java.lang.String field)
Description copied from interface:FetchPlan
Return true if the given field has been added.
-
hasField
public boolean hasField(java.lang.Class cls, java.lang.String field)
Description copied from interface:FetchPlan
Return true if the given field has been added.
-
addField
public FetchPlan addField(java.lang.String field)
Description copied from interface:FetchPlan
Addsfield
to the set of fully-qualified field names to use when loading objects.
-
addField
public FetchPlan addField(java.lang.Class cls, java.lang.String field)
Description copied from interface:FetchPlan
Addsfield
to the set of field names to use when loading objects.
-
addFields
public FetchPlan addFields(java.lang.String... fields)
Description copied from interface:FetchPlan
Addsfields
to the set of fully-qualified field names to use when loading objects.
-
addFields
public FetchPlan addFields(java.lang.Class cls, java.lang.String... fields)
Description copied from interface:FetchPlan
Addsfields
to the set of field names to use when loading objects.
-
addFields
public FetchPlan addFields(java.util.Collection fields)
Description copied from interface:FetchPlan
Addsfields
to the set of fully-qualified field names to use when loading objects.
-
addFields
public FetchPlan addFields(java.lang.Class cls, java.util.Collection fields)
Description copied from interface:FetchPlan
Addsfields
to the set of field names to use when loading objects.
-
removeField
public FetchPlan removeField(java.lang.String field)
Description copied from interface:FetchPlan
Remove the given fully-qualified field.- Specified by:
removeField
in interfaceFetchPlan
-
removeField
public FetchPlan removeField(java.lang.Class cls, java.lang.String field)
Description copied from interface:FetchPlan
Remove the given field.- Specified by:
removeField
in interfaceFetchPlan
-
removeFields
public FetchPlan removeFields(java.lang.String... fields)
Description copied from interface:FetchPlan
Removesfields
from the set of fully-qualified field names to use when loading objects.- Specified by:
removeFields
in interfaceFetchPlan
-
removeFields
public FetchPlan removeFields(java.lang.Class cls, java.lang.String... fields)
Description copied from interface:FetchPlan
Removesfields
from the set of field names to use when loading objects.- Specified by:
removeFields
in interfaceFetchPlan
-
removeFields
public FetchPlan removeFields(java.util.Collection fields)
Description copied from interface:FetchPlan
Removesfields
from the set of fully-qualified field names to use when loading objects.- Specified by:
removeFields
in interfaceFetchPlan
-
removeFields
public FetchPlan removeFields(java.lang.Class cls, java.util.Collection fields)
Description copied from interface:FetchPlan
Removesfields
from the set of field names to use when loading objects.- Specified by:
removeFields
in interfaceFetchPlan
-
clearFields
public FetchPlan clearFields()
Description copied from interface:FetchPlan
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.- Specified by:
clearFields
in interfaceFetchPlan
-
getLockTimeout
public int getLockTimeout()
Description copied from interface:FetchPlan
The number of milliseconds to wait for an object lock, or -1 for no limit.- Specified by:
getLockTimeout
in interfaceFetchPlan
-
setLockTimeout
public FetchPlan setLockTimeout(int timeout)
Description copied from interface:FetchPlan
The number of milliseconds to wait for an object lock, or -1 for no limit.- Specified by:
setLockTimeout
in interfaceFetchPlan
-
getLockScope
public jakarta.persistence.PessimisticLockScope getLockScope()
Description copied from interface:FetchPlan
The lock scope to use for locking loaded objects.- Specified by:
getLockScope
in interfaceFetchPlan
-
setLockScope
public FetchPlan setLockScope(jakarta.persistence.PessimisticLockScope scope)
Description copied from interface:FetchPlan
The lock scope to use for locking loaded objects.- Specified by:
setLockScope
in interfaceFetchPlan
-
getQueryTimeout
public int getQueryTimeout()
Description copied from interface:FetchPlan
The number of milliseconds to wait for a query, or -1 for no limit.- Specified by:
getQueryTimeout
in interfaceFetchPlan
-
setQueryTimeout
public FetchPlan setQueryTimeout(int timeout)
Description copied from interface:FetchPlan
The number of milliseconds to wait for a query, or -1 for no limit.- Specified by:
setQueryTimeout
in interfaceFetchPlan
-
getReadLockMode
public jakarta.persistence.LockModeType getReadLockMode()
Description copied from interface:FetchPlan
The lock level to use for locking loaded objects.- Specified by:
getReadLockMode
in interfaceFetchPlan
-
setReadLockMode
public FetchPlan setReadLockMode(jakarta.persistence.LockModeType mode)
Description copied from interface:FetchPlan
The lock level to use for locking loaded objects.- Specified by:
setReadLockMode
in interfaceFetchPlan
-
getWriteLockMode
public jakarta.persistence.LockModeType getWriteLockMode()
Description copied from interface:FetchPlan
The lock level to use for locking dirtied objects.- Specified by:
getWriteLockMode
in interfaceFetchPlan
-
setWriteLockMode
public FetchPlan setWriteLockMode(jakarta.persistence.LockModeType mode)
Description copied from interface:FetchPlan
The lock level to use for locking dirtied objects.- Specified by:
setWriteLockMode
in interfaceFetchPlan
-
getExtendedPathLookup
public boolean getExtendedPathLookup()
Description copied from interface:FetchPlan
Affirms if extended path lookup feature is active.- Specified by:
getExtendedPathLookup
in interfaceFetchPlan
-
setExtendedPathLookup
public FetchPlan setExtendedPathLookup(boolean flag)
Description copied from interface:FetchPlan
Sets extended path lookup feature.- Specified by:
setExtendedPathLookup
in interfaceFetchPlan
-
getHint
public java.lang.Object getHint(java.lang.String key)
Description copied from interface:FetchPlan
Get the hint value for the given key.
-
setHint
public void setHint(java.lang.String key, java.lang.Object value)
Sets the hint after converting the value appropriately. If a higher ranking equivalent hint is already set, then bypasses this hint.
-
setHints
public void setHints(java.util.Map<java.lang.String,java.lang.Object> hints)
-
getHints
public java.util.Map<java.lang.String,java.lang.Object> getHints()
Description copied from interface:FetchPlan
Get the hints and their values currently set on this receiver.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
getCacheRetrieveMode
public DataCacheRetrieveMode getCacheRetrieveMode()
Description copied from interface:FetchPlan
Gets the current retrieve mode for data cache.- Specified by:
getCacheRetrieveMode
in interfaceFetchPlan
-
getCacheStoreMode
public DataCacheStoreMode getCacheStoreMode()
Description copied from interface:FetchPlan
Gets the current storage mode for data cache.- Specified by:
getCacheStoreMode
in interfaceFetchPlan
-
setCacheStoreMode
public FetchPlan setCacheStoreMode(DataCacheStoreMode mode)
Description copied from interface:FetchPlan
Sets the current storage mode for data cache.- Specified by:
setCacheStoreMode
in interfaceFetchPlan
-
setCacheRetrieveMode
public FetchPlan setCacheRetrieveMode(DataCacheRetrieveMode mode)
Description copied from interface:FetchPlan
Sets the current retrieve mode for data cache.- Specified by:
setCacheRetrieveMode
in interfaceFetchPlan
-
-