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

public Class CacheBasedValueHolder<T>

extends DatabaseValueHolder<T>
Class Inheritance
Imports
java.util.Collection, org.eclipse.persistence.exceptions.DatabaseException, .ValidationException, org.eclipse.persistence.internal.queries.ContainerPolicy, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, .UnitOfWorkImpl, org.eclipse.persistence.mappings.ForeignReferenceMapping

Purpose: In certain cases the contents of a relationship may be retrievable from a cache. This ValueHolder instance provides the mechanism to store a cached relationship and to load that relationship from a cache. This functionality requires that the persistent identities of the targets can be collected as database type foreign key queries are unavailable.

Author
gyorke
Since
EclipseLink 1.1

Field Summary

Modifier and TypeField and Description
protected transient ForeignReferenceMapping
protected Object[]
protected boolean
shouldAllowInstantiationDeferral

Setting to force the instantiation of the Collection on modification

Inherited from org.eclipse.persistence.internal.indirection.DatabaseValueHolder:
isCoordinatedWithPropertyisInstantiatedrowsessionvalue

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Object[]
public T
getValue(UnitOfWorkImpl uow)

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

Process against the UOW and attempt to load a local copy before going to the shared cache If null is returned then the calling UOW will instantiate as normal.
protected T
protected T
public T
instantiateForUnitOfWorkValueHolder(UnitOfWorkValueHolder<T> unitOfWorkValueHolder)

Implements abstract org.eclipse.persistence.internal.indirection.DatabaseValueHolder.instantiateForUnitOfWorkValueHolder.

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

Set if instantiation deferral on modification should be available.

public boolean
Inherited from org.eclipse.persistence.internal.indirection.DatabaseValueHolder:
clonegetRowgetSessiongetValuegetWrappedValueHolderisCoordinatedWithPropertyisEasilyInstantiatedisInstantiatedisNewlyWeavedValueHolderisSerializedRemoteUnitOfWorkValueHolderisTransactionalValueHolderpostInstantiateprivilegedSetValuereleaseWrappedValueHolderresetFieldssetInstantiatedsetIsCoordinatedWithPropertysetIsNewlyWeavedValueHoldersetRowsetSessionsetUninstantiatedsetValuetoString

Field Detail

mappingback to summary
protected transient ForeignReferenceMapping mapping
referencesback to summary
protected Object[] references
shouldAllowInstantiationDeferralback to summary
protected boolean shouldAllowInstantiationDeferral

Setting to force the instantiation of the Collection on modification

Constructor Detail

CacheBasedValueHolderback to summary
public CacheBasedValueHolder(Object[] pks, AbstractRecord foreignKeys, AbstractSession session, ForeignReferenceMapping mapping)

Method Detail

getCachedPKsback to summary
public Object[] getCachedPKs()
getValueback to summary
public T getValue(UnitOfWorkImpl uow)

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

Process against the UOW and attempt to load a local copy before going to the shared cache If null is returned then the calling UOW will instantiate as normal.

Annotations
@Override
@SuppressWarnings:unchecked
instantiateback to summary
protected T instantiate() throws DatabaseException

Implements abstract org.eclipse.persistence.internal.indirection.DatabaseValueHolder.instantiate.

Doc from org.eclipse.persistence.internal.indirection.DatabaseValueHolder.instantiate.

Instantiate the object.

Annotations
@Override
instantiateback to summary
protected T instantiate(AbstractSession localSession) throws DatabaseException
Annotations
@SuppressWarnings:unchecked
instantiateForUnitOfWorkValueHolderback to summary
public T instantiateForUnitOfWorkValueHolder(UnitOfWorkValueHolder<T> unitOfWorkValueHolder)

Implements abstract org.eclipse.persistence.internal.indirection.DatabaseValueHolder.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

Annotations
@Override
isPessimisticLockingValueHolderback to summary
public boolean isPessimisticLockingValueHolder()

Implements abstract org.eclipse.persistence.internal.indirection.DatabaseValueHolder.isPessimisticLockingValueHolder.

Doc from org.eclipse.persistence.internal.indirection.DatabaseValueHolder.isPessimisticLockingValueHolder.

Answers if this valueholder is a pessimistic locking one. Such valueholders are special in that they can be triggered multiple times by different UnitsOfWork. Each time a lock query will be issued. Hence even if instantiated it may have to be instantiated again, and once instantiated all fields can not be reset.

Note

Implementations of this method are not necessarily thread-safe. They must be used in a synchronizaed manner

Annotations
@Override
setShouldAllowInstantiationDeferralback to summary
public void setShouldAllowInstantiationDeferral(boolean shouldAllowInstantiationDeferral)

Set if instantiation deferral on modification should be available.

shouldAllowInstantiationDeferralback to summary
public boolean shouldAllowInstantiationDeferral()

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

Implements org.eclipse.persistence.indirection.WeavedAttributeValueHolderInterface.shouldAllowInstantiationDeferral.

INTERNAL: Return if add/remove should trigger instantiation or avoid. Current instantiation is avoided is using change tracking.

Annotations
@Override