Top Description Fields Constructors Methods
org.eclipse.persistence.internal.indirection

public Class BatchValueHolder<T>

extends QueryBasedValueHolder<T>
Class Inheritance
Imports
org.eclipse.persistence.internal.identitymaps.CacheKey, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, .UnitOfWorkImpl, org.eclipse.persistence.mappings.*, org.eclipse.persistence.queries.*, org.eclipse.persistence.exceptions.*

BatchValueHolder is used by the mappings that use indirection when using query optimization (batch reading). This value holder is different from QueryBasedValueHolder in that its value must be extracted from one of the results return by the query, not the entire result. The query is also shared by all other value holders within the batch and it must be ensured that the query is only executed once. Concurrency must also be maintained across all of the value holders in the batch.

Field Summary

Modifier and TypeField and Description
protected transient ForeignReferenceMapping
protected transient ObjectLevelReadQuery
protected transient CacheKey
Inherited from org.eclipse.persistence.internal.indirection.QueryBasedValueHolder:
queryrefreshCascadesourceObject

Constructor Summary

AccessConstructor and Description
public
BatchValueHolder(ReadQuery
The query that returns the object when executed.
query
,
AbstractRecord
The row representation of the object.
row
,
ForeignReferenceMapping
The mapping that is uses batch reading.
mapping
,
ObjectLevelReadQuery originalQuery, CacheKey parentCacheKey)

Initialize the query-based value holder.

Method Summary

Modifier and TypeMethod and Description
protected ForeignReferenceMapping
protected T
instantiate(AbstractSession session)

Overrides org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.instantiate.

Instantiate the object by having the mapping extract its value from the query.
public T
instantiateForUnitOfWorkValueHolder(UnitOfWorkValueHolder<T> unitOfWorkValueHolder)

Overrides org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.instantiateForUnitOfWorkValueHolder.

Triggers UnitOfWork valueholders directly without triggering the wrapped valueholder (this).
public boolean

Returns:

true if getValue() won't trigger a database read.
isEasilyInstantiated
()

Overrides org.eclipse.persistence.internal.indirection.DatabaseValueHolder.isEasilyInstantiated.

INTERNAL: Answers if this valueholder is easy to instantiate.
protected void
resetFields()

Overrides org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.resetFields.

Reset all the fields that are not needed after instantiation.
protected void
Inherited from org.eclipse.persistence.internal.indirection.QueryBasedValueHolder:
getQuerygetRefreshCascadePolicygetValueinstantiateisPessimisticLockingValueHolderpostInstantiatereleaseWrappedValueHoldersetQuerysetRefreshCascadePolicysetSourceObject

Field Detail

mappingback to summary
protected transient ForeignReferenceMapping mapping
originalQueryback to summary
protected transient ObjectLevelReadQuery originalQuery
parentCacheKeyback to summary
protected transient CacheKey parentCacheKey

Constructor Detail

BatchValueHolderback to summary
public BatchValueHolder(ReadQuery query, AbstractRecord row, ForeignReferenceMapping mapping, ObjectLevelReadQuery originalQuery, CacheKey parentCacheKey)

Initialize the query-based value holder.

Parameters
query:ReadQuery

The query that returns the object when executed.

row:AbstractRecord

The row representation of the object.

mapping:ForeignReferenceMapping

The mapping that is uses batch reading.

Method Detail

getMappingback to summary
protected ForeignReferenceMapping getMapping()
instantiateback to summary
protected T instantiate(AbstractSession session) throws EclipseLinkException

Overrides org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.instantiate.

Instantiate the object by having the mapping extract its value from the query. Concurrency must be maintained across all of the value holders, since they all share the same query, the extractResultFromBatchQuery method must be synchronized.

Annotations
@Override
@SuppressWarnings:unchecked
instantiateForUnitOfWorkValueHolderback to summary
public T instantiateForUnitOfWorkValueHolder(UnitOfWorkValueHolder<T> unitOfWorkValueHolder)

Overrides org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.instantiateForUnitOfWorkValueHolder.

Triggers UnitOfWork valueholders directly without triggering the wrapped valueholder (this).

When in transaction and/or for pessimistic locking the UnitOfWorkValueHolder needs to be triggered directly without triggering the wrapped valueholder. However only the wrapped valueholder knows how to trigger the indirection, i.e. it may be a batchValueHolder, and it stores all the info like the row and the query.

Note

This method is not thread-safe. It must be used in a synchronized manner. The batch value holder must use a batch query relative to the unit of work, as the batch is local to the unit of work.

Annotations
@Override
@SuppressWarnings:unchecked
isEasilyInstantiatedback to summary
public boolean isEasilyInstantiated()

Overrides org.eclipse.persistence.internal.indirection.DatabaseValueHolder.isEasilyInstantiated.

INTERNAL: Answers if this valueholder is easy to instantiate.

Returns:boolean

true if getValue() won't trigger a database read.

Annotations
@Override
resetFieldsback to summary
protected void resetFields()

Overrides org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.resetFields.

Reset all the fields that are not needed after instantiation.

Annotations
@Override
setMappingback to summary
protected void setMapping(ForeignReferenceMapping mapping)