public class QueryBasedValueHolder extends DatabaseValueHolder
ObjectLevelReadQuery
,
Serialized FormshouldToStringInstantiate
Constructor and Description |
---|
QueryBasedValueHolder(ReadQuery query,
AbstractRecord row,
AbstractSession session)
Initialize the query-based value holder.
|
QueryBasedValueHolder(ReadQuery query,
java.lang.Object sourceObject,
AbstractRecord row,
AbstractSession session)
Initialize the query-based value holder.
|
Modifier and Type | Method and Description |
---|---|
ReadQuery |
getQuery()
Return the query.
|
java.lang.Integer |
getRefreshCascadePolicy()
INTERNAL:
Returns the refresh cascade policy that was set on the query that was used to instantiate the valueholder
a null value means that a non refresh query was used.
|
java.lang.Object |
getValue(UnitOfWorkImpl uow)
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.
|
java.lang.Object |
instantiateForUnitOfWorkValueHolder(UnitOfWorkValueHolder unitOfWorkValueHolder)
Triggers UnitOfWork valueholders directly without triggering the wrapped
valueholder (this).
|
boolean |
isPessimisticLockingValueHolder()
INTERNAL: Answers if this valueholder is a pessimistic locking one.
|
void |
postInstantiate()
INTERNAL:
Run any extra code required after the valueholder instantiates
For query based VH, we notify the cache that the valueholder has been triggered
|
void |
releaseWrappedValueHolder(AbstractSession targetSession)
Releases a wrapped valueholder privately owned by a particular unit of
work.
|
void |
setRefreshCascadePolicy(java.lang.Integer refreshCascadePolicy)
INTERNAL:
|
void |
setSourceObject(java.lang.Object sourceObject) |
clone, getRow, getSession, getValue, getWrappedValueHolder, isCoordinatedWithProperty, isEasilyInstantiated, isInstantiated, isNewlyWeavedValueHolder, isSerializedRemoteUnitOfWorkValueHolder, privilegedSetValue, setInstantiated, setIsCoordinatedWithProperty, setIsNewlyWeavedValueHolder, setRow, setSession, setUninstantiated, setValue, shouldAllowInstantiationDeferral, toString
public QueryBasedValueHolder(ReadQuery query, AbstractRecord row, AbstractSession session)
public QueryBasedValueHolder(ReadQuery query, java.lang.Object sourceObject, AbstractRecord row, AbstractSession session)
public java.lang.Integer getRefreshCascadePolicy()
public java.lang.Object getValue(UnitOfWorkImpl uow)
getValue
in class DatabaseValueHolder
public ReadQuery getQuery()
public java.lang.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: This method is not thread-safe. It must be used in a synchronized manner
instantiateForUnitOfWorkValueHolder
in class DatabaseValueHolder
public void postInstantiate()
postInstantiate
in class DatabaseValueHolder
QueryBasedValueHolder
public void releaseWrappedValueHolder(AbstractSession targetSession)
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
public boolean isPessimisticLockingValueHolder()
Since locks will be issued each time this valueholder is triggered, triggering this directly on the session in auto commit mode will generate an exception. This only UnitOfWorkValueHolder's wrapping this can trigger it. Note: This method is not thread-safe. It must be used in a synchronized manner
isPessimisticLockingValueHolder
in class DatabaseValueHolder
public void setSourceObject(java.lang.Object sourceObject)
public void setRefreshCascadePolicy(java.lang.Integer refreshCascadePolicy)
refreshCascadePolicy
- EclipseLink 2.6.3, "build v20160428-59c81c5" API Reference