Module org.eclipse.persistence.core
Class RemoteValueHolder<T>
java.lang.Object
org.eclipse.persistence.internal.indirection.DatabaseValueHolder<T>
org.eclipse.persistence.internal.sessions.remote.RemoteValueHolder<T>
- All Implemented Interfaces:
Externalizable
,Serializable
,Cloneable
,ValueHolderInterface<T>
,WeavedAttributeValueHolderInterface<T>
Remote value holders can be invoked locally and remotely.
In both situations the associated indirect object is invoked.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected ObjID
protected DatabaseMapping
protected ObjectLevelReadQuery
protected Object
protected Object
protected ValueHolderInterface
<T> Fields inherited from class org.eclipse.persistence.internal.indirection.DatabaseValueHolder
isCoordinatedWithProperty, isInstantiated, row, session, value
Fields inherited from interface org.eclipse.persistence.indirection.ValueHolderInterface
shouldToStringInstantiate
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
If the reference object is mapped thru one to one mapping and the object derives its primary key value from this relationship then remote value holder has a primary key row for.boolean
Only the id is checked for equality check.void
finalize()
This method is used to remove the RemoteValueHolder from the dispatcher on Garbage collection from the clientgetID()
Return the unique id.Return the associated mapping.protected Object
Get object from the cache if there is one.getQuery()
Return the associated query.Return the object on the server that holds on to the remote value holder.protected Object
Get target object primary key row.Return the original value holder.int
hashCode()
Return the hashcode for id, because it is unqiue.Return the object.instantiateForUnitOfWorkValueHolder
(UnitOfWorkValueHolder<T> unitOfWorkValueHolder) Triggers UnitOfWork valueholders directly without triggering the wrapped valueholder (this).boolean
INTERNAL: Answers if this valueholder is easy to instantiate.boolean
INTERNAL: Answers if this valueholder is a pessimistic locking one.void
Override the default serialization for a remote valueholder so as not to serialize the value Note: Changed for bug 3145211.protected void
Set the unique id.void
setMapping
(DatabaseMapping mapping) Set mappingvoid
setQuery
(ObjectLevelReadQuery query) Set the query.void
setServerIndirectionObject
(Object serverIndirectionObject) Set the object on the server that holds on to the remote value holder.void
setTargetObjectPrimaryKeys
(Object primaryKeys) Set target object primary keys.void
Set the object.void
setWrappedServerValueHolder
(ValueHolderInterface<T> wrappedServerValueHolder) Set the original value holder.void
Override the default serialization for a remote valueholder so as not to serialize the value Note: Changed for bug 3145211.Methods inherited from class org.eclipse.persistence.internal.indirection.DatabaseValueHolder
clone, getRow, getSession, getValue, getValue, getWrappedValueHolder, isCoordinatedWithProperty, isInstantiated, isNewlyWeavedValueHolder, isSerializedRemoteUnitOfWorkValueHolder, isTransactionalValueHolder, postInstantiate, privilegedSetValue, releaseWrappedValueHolder, resetFields, setInstantiated, setIsCoordinatedWithProperty, setIsNewlyWeavedValueHolder, setRow, setSession, setUninstantiated, shouldAllowInstantiationDeferral, toString
-
Field Details
-
id
-
targetObjectPrimaryKeys
-
mapping
-
query
-
wrappedServerValueHolder
-
serverIndirectionObject
-
-
Constructor Details
-
RemoteValueHolder
public RemoteValueHolder() -
RemoteValueHolder
-
-
Method Details
-
canDoCacheCheck
protected boolean canDoCacheCheck()If the reference object is mapped thru one to one mapping and the object derives its primary key value from this relationship then remote value holder has a primary key row for. -
equals
Only the id is checked for equality check. -
finalize
public void finalize()This method is used to remove the RemoteValueHolder from the dispatcher on Garbage collection from the client -
getID
Return the unique id. -
getMapping
Return the associated mapping. -
getObjectFromCache
Get object from the cache if there is one. -
getQuery
Return the associated query. -
getServerIndirectionObject
Return the object on the server that holds on to the remote value holder. Currently used only by TransparentIndirection so we can get back to the original IndirectContainer. -
getTargetObjectPrimaryKeys
Get target object primary key row. -
getWrappedServerValueHolder
Return the original value holder. This is null on the client side because it is tagged transient. This is how we know whether the remote value holder is being invoked on the client or on the server. -
hashCode
public int hashCode()Return the hashcode for id, because it is unqiue. -
instantiate
Return the object.- Specified by:
instantiate
in classDatabaseValueHolder<T>
-
isEasilyInstantiated
public boolean isEasilyInstantiated()INTERNAL: Answers if this valueholder is easy to instantiate.- Overrides:
isEasilyInstantiated
in classDatabaseValueHolder<T>
- Returns:
- true if getValue() won't trigger a database read.
-
isPessimisticLockingValueHolder
public boolean 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. Note: This method is not thread-safe. It must be used in a synchronizaed manner- Specified by:
isPessimisticLockingValueHolder
in classDatabaseValueHolder<T>
-
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. Note: This method is not thread-safe. It must be used in a synchronizaed manner
- Specified by:
instantiateForUnitOfWorkValueHolder
in classDatabaseValueHolder<T>
-
readExternal
Override the default serialization for a remote valueholder so as not to serialize the value Note: Changed for bug 3145211. We used to use the java.io.Serializable interface, but need to convert to Externalizable interface to avoid sending extra data through the superclass's serialization- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
setID
Set the unique id. -
setMapping
Set mapping -
setQuery
Set the query. -
setServerIndirectionObject
Set the object on the server that holds on to the remote value holder. Currently used only by TransparentIndirection so we can get back to the original IndirectContainer. -
setTargetObjectPrimaryKeys
Set target object primary keys. -
setValue
Set the object.- Specified by:
setValue
in interfaceValueHolderInterface<T>
- Overrides:
setValue
in classDatabaseValueHolder<T>
-
setWrappedServerValueHolder
Set the original value holder. -
writeExternal
Override the default serialization for a remote valueholder so as not to serialize the value Note: Changed for bug 3145211. We used to use the java.io.Serializable interface, but need to convert to Externalizable interface to avoid sending extra data through the superclass's serialization- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-