public abstract class DatabaseValueHolder extends Object implements WeavedAttributeValueHolderInterface, Cloneable, Serializable
ValueHolderInterface
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected boolean |
isCoordinatedWithProperty
The variable below is used as part of the implementation of WeavedAttributeValueHolderInterface
It is used to track whether a valueholder that has been weaved into a class is coordinated
with the underlying property
Set internally in TopLink when the state of coordination between a weaved valueholder and the underlying property is known
|
protected boolean |
isInstantiated
Indicates whether the object has been read from the database or not.
|
protected AbstractRecord |
row
Stores the row representation of the object.
|
protected AbstractSession |
session
Stores the session for the database that contains the object.
|
protected Object |
value
Stores the object after it is read from the database.
|
shouldToStringInstantiate
Constructor and Description |
---|
DatabaseValueHolder() |
Modifier and Type | Method and Description |
---|---|
Object |
clone() |
AbstractRecord |
getRow()
Return the row.
|
AbstractSession |
getSession()
Return the session.
|
Object |
getValue()
Return the object.
|
protected abstract Object |
instantiate()
Instantiate the object.
|
abstract Object |
instantiateForUnitOfWorkValueHolder(UnitOfWorkValueHolder unitOfWorkValueHolder)
Triggers UnitOfWork valueholders directly without triggering the wrapped
valueholder (this).
|
boolean |
isCoordinatedWithProperty()
This method is used as part of the implementation of WeavedAttributeValueHolderInterface
It is used to check whether a valueholder that has been weaved into a class is coordinated
with the underlying property
|
boolean |
isEasilyInstantiated()
INTERNAL:
Answers if this valueholder is easy to instantiate.
|
boolean |
isInstantiated()
Return a boolean indicating whether the object
has been read from the database or not.
|
boolean |
isNewlyWeavedValueHolder()
This method is used as part of the implementation of WeavedAttributeValueHolderInterface.
|
abstract boolean |
isPessimisticLockingValueHolder()
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.
|
protected boolean |
isTransactionalValueHolder()
Answers if this valueholder is referenced only by a UnitOfWork valueholder.
|
void |
privilegedSetValue(Object value)
Set the object.
|
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 |
setInstantiated()
Set the instantiated flag to true.
|
void |
setIsCoordinatedWithProperty(boolean coordinated)
This method is used as part of the implementation of WeavedAttributeValueHolderInterface
It is used internally by TopLink to set whether a valueholder that has been weaved into a class is coordinated
with the underlying property
|
void |
setIsNewlyWeavedValueHolder(boolean isNew)
This method is used as part of the implementation of WeavedAttributeValueHolderInterface
A DatabaseValueHolder is set up by TopLink and will never be a newly weaved valueholder
As a result, this method is stubbed out.
|
void |
setRow(AbstractRecord row)
Set the row.
|
void |
setSession(AbstractSession session)
Set the session.
|
void |
setUninstantiated()
Set the instantiated flag to false.
|
void |
setValue(Object value)
Set the object.
|
String |
toString() |
protected Object value
protected boolean isInstantiated
protected transient AbstractSession session
protected AbstractRecord row
protected boolean isCoordinatedWithProperty
public AbstractRecord getRow()
public AbstractSession getSession()
public Object getValue()
getValue
in interface ValueHolderInterface
protected abstract Object instantiate() throws DatabaseException
DatabaseException
public abstract 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. Note: Implementations of this method are not necessarily thread-safe. They must be used in a synchronizaed manner
public boolean isCoordinatedWithProperty()
isCoordinatedWithProperty
in interface WeavedAttributeValueHolderInterface
public boolean isNewlyWeavedValueHolder()
isNewlyWeavedValueHolder
in interface WeavedAttributeValueHolderInterface
public boolean isEasilyInstantiated()
public boolean isInstantiated()
isInstantiated
in interface ValueHolderInterface
public abstract boolean isPessimisticLockingValueHolder()
protected boolean isTransactionalValueHolder()
Sometimes in transaction a UnitOfWork clone, and all valueholders, are built directly from the row; however a UnitOfWorkValueHolder does not know how to instantiate itself so wraps this which does.
On a successful merge must be released to the session cache with releaseWrappedValueHolder.
public boolean isSerializedRemoteUnitOfWorkValueHolder()
public void privilegedSetValue(Object value)
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.
protected void resetFields()
public void setIsCoordinatedWithProperty(boolean coordinated)
setIsCoordinatedWithProperty
in interface WeavedAttributeValueHolderInterface
public void setIsNewlyWeavedValueHolder(boolean isNew)
setIsNewlyWeavedValueHolder
in interface WeavedAttributeValueHolderInterface
public void setInstantiated()
public void setRow(AbstractRecord row)
public void setSession(AbstractSession session)
public void setUninstantiated()
public void setValue(Object value)
setValue
in interface ValueHolderInterface
Copyright © 2022. All rights reserved.