public abstract class UnitOfWorkValueHolder extends DatabaseValueHolder
Modifier and Type | Field and Description |
---|---|
protected ValueHolder |
backupValueHolder
The value holder stored in the backup copy, should not be transient.
|
protected DatabaseMapping |
mapping
The mapping for the attribute.
|
protected 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 |
sourceAttributeName |
protected Object |
sourceObject |
protected ValueHolderInterface |
wrappedValueHolder
The value holder in the original object.
|
protected ObjID |
wrappedValueHolderRemoteID |
isCoordinatedWithProperty, isInstantiated, row, session, value
shouldToStringInstantiate
Modifier | Constructor and Description |
---|---|
protected |
UnitOfWorkValueHolder(ValueHolderInterface attributeValue,
Object clone,
DatabaseMapping mapping,
UnitOfWorkImpl unitOfWork) |
Modifier and Type | Method and Description |
---|---|
protected abstract Object |
buildBackupCloneFor(Object cloneAttributeValue)
Backup the clone attribute value.
|
abstract Object |
buildCloneFor(Object originalAttributeValue)
Clone the original attribute value.
|
protected ValueHolder |
getBackupValueHolder() |
protected DatabaseMapping |
getMapping() |
protected Object |
getRelationshipSourceObject() |
protected UnitOfWorkImpl |
getRemoteUnitOfWork() |
protected String |
getSourceAttributeName() |
protected Object |
getSourceObject() |
protected UnitOfWorkImpl |
getUnitOfWork() |
protected Object |
getValueFromServerObject()
This is used for a remote unit of work.
|
ValueHolderInterface |
getWrappedValueHolder() |
ObjID |
getWrappedValueHolderRemoteID()
returns wrapped ValueHolder ObjID if available
|
protected Object |
instantiate()
Get the value from the wrapped value holder, instantiating it
if necessary, and clone it.
|
Object |
instantiateForUnitOfWorkValueHolder(UnitOfWorkValueHolder unitOfWorkValueHolder)
Triggers UnitOfWork valueholders directly without triggering the wrapped
valueholder (this).
|
protected Object |
instantiateImpl()
a.k.a getValueFromWrappedValueholder.
|
boolean |
isEasilyInstantiated()
INTERNAL:
Answers if this valueholder is easy to instantiate.
|
boolean |
isPessimisticLockingValueHolder()
INTERNAL:
Answers if this valueholder is a pessimistic locking one.
|
boolean |
isSerializedRemoteUnitOfWorkValueHolder()
Used to determine if this is a remote uow value holder that was serialized to the server.
|
void |
releaseWrappedValueHolder()
Releases a wrapped valueholder privately owned by a particular unit of work.
|
protected void |
resetFields()
Reset all the fields that are not needed after instantiation.
|
void |
setBackupValueHolder(ValueHolder backupValueHolder) |
protected void |
setMapping(DatabaseMapping mapping) |
protected void |
setRelationshipSourceObject(Object relationshipSourceObject) |
protected void |
setRemoteUnitOfWork(UnitOfWorkImpl remoteUnitOfWork) |
protected void |
setSourceAttributeName(String name) |
protected void |
setSourceObject(Object sourceObject) |
protected void |
setWrappedValueHolder(DatabaseValueHolder valueHolder) |
clone, getRow, getSession, getValue, isCoordinatedWithProperty, isInstantiated, isNewlyWeavedValueHolder, isTransactionalValueHolder, privilegedSetValue, setInstantiated, setIsCoordinatedWithProperty, setIsNewlyWeavedValueHolder, setRow, setSession, setUninstantiated, setValue, toString
protected transient ValueHolderInterface wrappedValueHolder
protected transient DatabaseMapping mapping
protected ValueHolder backupValueHolder
protected UnitOfWorkImpl remoteUnitOfWork
protected Object sourceObject
protected transient Object relationshipSourceObject
protected String sourceAttributeName
protected ObjID wrappedValueHolderRemoteID
protected UnitOfWorkValueHolder(ValueHolderInterface attributeValue, Object clone, DatabaseMapping mapping, UnitOfWorkImpl unitOfWork)
protected abstract Object buildBackupCloneFor(Object cloneAttributeValue)
public abstract Object buildCloneFor(Object originalAttributeValue)
protected ValueHolder getBackupValueHolder()
protected DatabaseMapping getMapping()
protected UnitOfWorkImpl getRemoteUnitOfWork()
protected String getSourceAttributeName()
protected Object getSourceObject()
protected Object getRelationshipSourceObject()
protected UnitOfWorkImpl getUnitOfWork()
protected Object getValueFromServerObject()
protected Object instantiateImpl()
public boolean isEasilyInstantiated()
isEasilyInstantiated
in class DatabaseValueHolder
public boolean isPessimisticLockingValueHolder()
isPessimisticLockingValueHolder
in class DatabaseValueHolder
public ValueHolderInterface getWrappedValueHolder()
public ObjID getWrappedValueHolderRemoteID()
public boolean isSerializedRemoteUnitOfWorkValueHolder()
isSerializedRemoteUnitOfWorkValueHolder
in class DatabaseValueHolder
protected Object instantiate()
instantiate
in class DatabaseValueHolder
public Object instantiateForUnitOfWorkValueHolder(UnitOfWorkValueHolder unitOfWorkValueHolder)
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.
instantiateForUnitOfWorkValueHolder
in class DatabaseValueHolder
public void releaseWrappedValueHolder()
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.
releaseWrappedValueHolder
in class DatabaseValueHolder
protected void resetFields()
resetFields
in class DatabaseValueHolder
public void setBackupValueHolder(ValueHolder backupValueHolder)
protected void setMapping(DatabaseMapping mapping)
protected void setRemoteUnitOfWork(UnitOfWorkImpl remoteUnitOfWork)
protected void setSourceAttributeName(String name)
protected void setSourceObject(Object sourceObject)
protected void setRelationshipSourceObject(Object relationshipSourceObject)
protected void setWrappedValueHolder(DatabaseValueHolder valueHolder)
Copyright © 2021. All rights reserved.