public class QueryBasedValueHolder extends DatabaseValueHolder
ObjectLevelReadQuery
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected ReadQuery |
query
Stores the query to be executed.
|
isCoordinatedWithProperty, isInstantiated, row, session, value
shouldToStringInstantiate
Constructor and Description |
---|
QueryBasedValueHolder(ReadQuery query,
AbstractRecord row,
AbstractSession session)
Initialize the query-based value holder.
|
Modifier and Type | Method and Description |
---|---|
protected ReadQuery |
getQuery()
Return the query.
|
protected Object |
instantiate()
Instantiate the object.
|
protected Object |
instantiate(AbstractSession session)
Instantiate the object by executing the query on the session.
|
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 |
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.
|
protected void |
setQuery(ReadQuery theQuery)
Set the query.
|
clone, getRow, getSession, getValue, isCoordinatedWithProperty, isEasilyInstantiated, isInstantiated, isNewlyWeavedValueHolder, isSerializedRemoteUnitOfWorkValueHolder, isTransactionalValueHolder, privilegedSetValue, setInstantiated, setIsCoordinatedWithProperty, setIsNewlyWeavedValueHolder, setRow, setSession, setUninstantiated, setValue, toString
protected transient ReadQuery query
public QueryBasedValueHolder(ReadQuery query, AbstractRecord row, AbstractSession session)
protected ReadQuery getQuery()
protected Object instantiate() throws DatabaseException
DatabaseValueHolder
instantiate
in class DatabaseValueHolder
DatabaseException
protected Object instantiate(AbstractSession session) throws DatabaseException
DatabaseException
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. Note: This method is not thread-safe. It must be used in a synchronizaed manner
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
protected void setQuery(ReadQuery theQuery)
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 synchronizaed manner
isPessimisticLockingValueHolder
in class DatabaseValueHolder
Copyright © 2022. All rights reserved.