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

public abstract Class UnitOfWorkValueHolder<T>

extends DatabaseValueHolder<T>
implements WrappingValueHolder<T>
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.internal.indirection.WrappingValueHolder
Known Direct Subclasses
org.eclipse.persistence.internal.indirection.UnitOfWorkQueryValueHolder, org.eclipse.persistence.internal.indirection.UnitOfWorkTransformerValueHolder
Imports
java.rmi.server.ObjID, org.eclipse.persistence.descriptors.ClassDescriptor, org.eclipse.persistence.exceptions.ValidationException, org.eclipse.persistence.indirection.*, org.eclipse.persistence.mappings.*, org.eclipse.persistence.internal.sessions.remote.RemoteValueHolder, org.eclipse.persistence.internal.sessions.AbstractSession, .UnitOfWorkImpl, org.eclipse.persistence.logging.SessionLog

A UnitOfWorkValueHolder is put in a clone object. It wraps the value holder in the original object to delay cloning the attribute in a unit of work until it is needed by the application. This value holder is used only in the unit of work.
Author
Sati

Field Summary

Modifier and TypeField and Description
protected ValueHolderInterface<T>
backupValueHolder

The value holder stored in the backup copy, should not be transient.

protected transient DatabaseMapping
mapping

The mapping for the attribute.

protected transient Object
relationshipSourceObject

This attribute is used specifically for relationship support.

protected UnitOfWorkImpl
remoteUnitOfWork

These cannot be transient because they are required for a remote unit of work.

protected String
protected Object
protected transient ValueHolderInterface<T>
wrappedValueHolder

The value holder in the original object.

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

Constructor Summary

AccessConstructor and Description
protected
protected
UnitOfWorkValueHolder(ValueHolderInterface<T> attributeValue, Object clone, DatabaseMapping mapping, UnitOfWorkImpl unitOfWork)

Method Summary

Modifier and TypeMethod and Description
protected abstract Object
buildBackupCloneFor(Object cloneAttributeValue)

Backup the clone attribute value.

public abstract T
buildCloneFor(Object originalAttributeValue)

Clone the original attribute value.

protected ValueHolderInterface<T>
public DatabaseMapping
protected Object
protected UnitOfWorkImpl
protected String
protected Object
protected UnitOfWorkImpl
protected T
getValueFromServerObject()

This is used for a remote unit of work.

public ValueHolderInterface<T>
public ObjID
getWrappedValueHolderRemoteID()

returns wrapped ValueHolder ObjID if available

protected T
instantiate()

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

Get the value from the wrapped value holder, instantiating it if necessary, and clone it.
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).
protected T
instantiateImpl()

a.k.a getValueFromWrappedValueholder.

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.
public boolean
isPessimisticLockingValueHolder()

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

INTERNAL: Answers if this valueholder is a pessimistic locking one.
public boolean
isSerializedRemoteUnitOfWorkValueHolder()

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

Used to determine if this is a remote uow value holder that was serialized to the server.
public void
releaseWrappedValueHolder(AbstractSession targetSession)

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

Releases a wrapped valueholder privately owned by a particular unit of work.
protected void
resetFields()

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

Reset all the fields that are not needed after instantiation.
public void
protected void
protected void
setRelationshipSourceObject(Object relationshipSourceObject)

protected void
protected void
protected void
setSourceObject(Object sourceObject)

protected void
public boolean
Inherited from org.eclipse.persistence.internal.indirection.DatabaseValueHolder:
clonegetRowgetSessiongetValuegetValueisCoordinatedWithPropertyisInstantiatedisNewlyWeavedValueHolderisTransactionalValueHolderpostInstantiateprivilegedSetValuesetInstantiatedsetIsCoordinatedWithPropertysetIsNewlyWeavedValueHoldersetRowsetSessionsetUninstantiatedsetValuetoString

Field Detail

backupValueHolderback to summary
protected ValueHolderInterface<T> backupValueHolder

The value holder stored in the backup copy, should not be transient.

mappingback to summary
protected transient DatabaseMapping mapping

The mapping for the attribute.

relationshipSourceObjectback to summary
protected transient Object relationshipSourceObject

This attribute is used specifically for relationship support. It mimics the sourceObject attribute which is used for RemoteValueholder

remoteUnitOfWorkback to summary
protected UnitOfWorkImpl remoteUnitOfWork

These cannot be transient because they are required for a remote unit of work. When the remote uow is serialized to the server to be committed, these are used to reconstruct the value holder on the server. They should be null for non-remote sessions.

sourceAttributeNameback to summary
protected String sourceAttributeName
sourceObjectback to summary
protected Object sourceObject
wrappedValueHolderback to summary
protected transient ValueHolderInterface<T> wrappedValueHolder

The value holder in the original object.

wrappedValueHolderRemoteIDback to summary
protected ObjID wrappedValueHolderRemoteID

Constructor Detail

UnitOfWorkValueHolderback to summary
protected UnitOfWorkValueHolder()
UnitOfWorkValueHolderback to summary
protected UnitOfWorkValueHolder(ValueHolderInterface<T> attributeValue, Object clone, DatabaseMapping mapping, UnitOfWorkImpl unitOfWork)

Method Detail

buildBackupCloneForback to summary
protected abstract Object buildBackupCloneFor(Object cloneAttributeValue)

Backup the clone attribute value.

buildCloneForback to summary
public abstract T buildCloneFor(Object originalAttributeValue)

Clone the original attribute value.

getBackupValueHolderback to summary
protected ValueHolderInterface<T> getBackupValueHolder()
getMappingback to summary
public DatabaseMapping getMapping()
getRelationshipSourceObjectback to summary
protected Object getRelationshipSourceObject()
getRemoteUnitOfWorkback to summary
protected UnitOfWorkImpl getRemoteUnitOfWork()
getSourceAttributeNameback to summary
protected String getSourceAttributeName()
getSourceObjectback to summary
protected Object getSourceObject()
getUnitOfWorkback to summary
protected UnitOfWorkImpl getUnitOfWork()
getValueFromServerObjectback to summary
protected T getValueFromServerObject()

This is used for a remote unit of work. If the value holder is sent back to the server uninstantiated and it needs to be instantiated, then we must find the original object and get the appropriate attribute from it.

Annotations
@SuppressWarnings:unchecked
getWrappedValueHolderback to summary
public ValueHolderInterface<T> getWrappedValueHolder()

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

Implements org.eclipse.persistence.internal.indirection.WrappingValueHolder.getWrappedValueHolder.

Doc from org.eclipse.persistence.internal.indirection.WrappingValueHolder.getWrappedValueHolder.

Returns the valueholder that is wrapped by this ValueHolder

Annotations
@Override
getWrappedValueHolderRemoteIDback to summary
public ObjID getWrappedValueHolderRemoteID()

returns wrapped ValueHolder ObjID if available

instantiateback to summary
protected T instantiate()

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

Get the value from the wrapped value holder, instantiating it if necessary, and clone it.

Annotations
@Override
@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.

Annotations
@Override
instantiateImplback to summary
protected T instantiateImpl()

a.k.a getValueFromWrappedValueholder. The old name is no longer correct, as query based valueholders are now sometimes triggered directly without triggering the underlying valueholder.

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
isPessimisticLockingValueHolderback to summary
public boolean isPessimisticLockingValueHolder()

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

INTERNAL: 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 instantatiated all fields can not be reset.

Annotations
@Override
isSerializedRemoteUnitOfWorkValueHolderback to summary
public boolean isSerializedRemoteUnitOfWorkValueHolder()

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

Used to determine if this is a remote uow value holder that was serialized to the server. It has no reference to its wrapper value holder, so must find its original object to be able to instantiate.

Annotations
@Override
releaseWrappedValueHolderback to summary
public void releaseWrappedValueHolder(AbstractSession targetSession)

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

Releases a wrapped valueholder privately owned by a particular unit of work.

When unit of work clones are built directly from rows no object in the shared cache points to this valueholder, so it can store the unit of work as its session. However once that UnitOfWork commits and the valueholder is merged into the shared cache, the session needs to be reset to the root session, ie. the server session.

Annotations
@Override
resetFieldsback to summary
protected void resetFields()

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

Reset all the fields that are not needed after instantiation.

Annotations
@Override
setBackupValueHolderback to summary
public void setBackupValueHolder(ValueHolderInterface<T> backupValueHolder)
setMappingback to summary
protected void setMapping(DatabaseMapping mapping)
setRelationshipSourceObjectback to summary
protected void setRelationshipSourceObject(Object relationshipSourceObject)
setRemoteUnitOfWorkback to summary
protected void setRemoteUnitOfWork(UnitOfWorkImpl remoteUnitOfWork)
setSourceAttributeNameback to summary
protected void setSourceAttributeName(String name)
setSourceObjectback to summary
protected void setSourceObject(Object sourceObject)
setWrappedValueHolderback to summary
protected void setWrappedValueHolder(DatabaseValueHolder<T> valueHolder)
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