public abstract class ForeignReferenceMapping extends DatabaseMapping
Modifier and Type | Field and Description |
---|---|
protected boolean |
cascadeMerge |
protected boolean |
cascadePersist
Cascading flags used by the EntityManager
|
protected boolean |
cascadeRefresh |
protected boolean |
cascadeRemove |
protected boolean |
hasCustomSelectionQuery
Indicates whether the selection query is TopLink generated or defined by the user.
|
protected IndirectionPolicy |
indirectionPolicy
Implements indirection behavior
|
protected boolean |
isPrivateOwned
Indicates whether the referenced object is privately owned or not.
|
protected Class |
referenceClass
This is used only in descriptor proxy in remote session
|
protected String |
referenceClassName |
protected ClassDescriptor |
referenceDescriptor
The descriptor of the reference class.
|
protected DatabaseMapping |
relationshipPartner
Used to reference the other half of a bi-directional relationship.
|
protected String |
relationshipPartnerAttributeName
Set by users, used to retreive the backpointer for this mapping
|
protected ReadQuery |
selectionQuery
This query is used to read referenced objects for this mapping.
|
protected AbstractSession |
tempInitSession
The session is temporarily used for initialization.
|
attributeAccessor, descriptor, fields, isOptional, isReadOnly, isRemotelyInitialized, NO_FIELDS, NO_WEIGHT, primaryKeyMapping, properties, weight, WEIGHT_1
Modifier | Constructor and Description |
---|---|
protected |
ForeignReferenceMapping() |
Modifier and Type | Method and Description |
---|---|
void |
buildBackupClone(Object clone,
Object backup,
UnitOfWorkImpl unitOfWork)
INTERNAL:
Clone the attribute from the clone and assign it to the backup.
|
abstract Object |
buildBackupCloneForPartObject(Object attributeValue,
Object clone,
Object backup,
UnitOfWorkImpl unitOfWork)
INTERNAL:
Used during building the backup shallow copy to copy the
target object without re-registering it.
|
void |
buildClone(Object original,
Object clone,
UnitOfWorkImpl unitOfWork,
JoinedAttributeManager joinedAttributeManager)
INTERNAL:
Clone the attribute from the original and assign it to the clone.
|
abstract Object |
buildCloneForPartObject(Object attributeValue,
Object original,
Object clone,
UnitOfWorkImpl unitOfWork,
boolean isExisting)
INTERNAL:
Require for cloning, the part must be cloned.
|
void |
buildCloneFromRow(AbstractRecord databaseRow,
JoinedAttributeManager joinManager,
Object clone,
ObjectBuildingQuery sourceQuery,
UnitOfWorkImpl unitOfWork,
AbstractSession executionSession)
INTERNAL:
A combination of readFromRowIntoObject and buildClone.
|
Object |
clone()
INTERNAL:
The mapping clones itself to create deep copy.
|
boolean |
compareObjects(Object firstObject,
Object secondObject,
AbstractSession session)
INTERNAL:
Compare the attributes belonging to this mapping for the objects.
|
protected abstract boolean |
compareObjectsWithoutPrivateOwned(Object first,
Object second,
AbstractSession session)
Compare two objects if their parts are not private owned
|
protected abstract boolean |
compareObjectsWithPrivateOwned(Object first,
Object second,
AbstractSession session)
Compare two objects if their parts are private owned
|
void |
convertClassNamesToClasses(ClassLoader classLoader)
INTERNAL:
Convert all the class-name-based settings in this mapping to actual class-based
settings.
|
UnitOfWorkValueHolder |
createUnitOfWorkValueHolder(ValueHolderInterface attributeValue,
Object original,
Object clone,
AbstractRecord row,
UnitOfWorkImpl unitOfWork,
boolean buildDirectlyFromRow)
INTERNAL:
Builder the unit of work value holder.
|
protected boolean |
dontDoMerge(Object target,
Object source,
MergeManager mergeManager)
INTERNAL:
Return true if the merge should be bypassed.
|
void |
dontUseIndirection()
PUBLIC:
Indirection means that a ValueHolder will be put in-between the attribute and the real object.
|
Object |
getAttributeValueFromObject(Object object)
INTERNAL:
Return the value of an attribute which this mapping represents for an object.
|
Object |
getAttributeValueWithClonedValueHolders(Object object)
INTERNAL:
Returns the attribute value from the reference object.
|
IndirectionPolicy |
getIndirectionPolicy()
INTERNAL:
Return the mapping's indirection policy.
|
Expression |
getJoinCriteria(QueryKeyExpression exp)
INTERNAL:
Returns the join criteria stored in the mapping selection query.
|
Object |
getRealAttributeValueFromObject(Object object,
AbstractSession session)
INTERNAL:
Returns the attribute value from the reference object.
|
Class |
getReferenceClass()
PUBLIC:
Returns the reference class.
|
String |
getReferenceClassName()
INTERNAL:
Returns the reference class name.
|
ClassDescriptor |
getReferenceDescriptor()
INTERNAL:
Return the referenceDescriptor.
|
DatabaseMapping |
getRelationshipPartner()
INTERNAL:
Return the relationshipPartner mapping for this bi-directional mapping.
|
String |
getRelationshipPartnerAttributeName()
PUBLIC:
Use this method retreive the relationship partner attribute name of this bidirectional Mapping.
|
Expression |
getSelectionCriteria()
INTERNAL:
Returns the selection criteria stored in the mapping selection query.
|
ReadQuery |
getSelectionQuery()
INTERNAL:
Returns the read query assoicated with the mapping.
|
protected AbstractSession |
getTempSession() |
boolean |
hasCustomSelectionQuery()
INTERNAL:
Indicates whether the selection query is TopLink generated or defined by
the user.
|
void |
initialize(AbstractSession session)
INTERNAL:
Initialize the state of mapping.
|
protected void |
initializeReferenceDescriptor(AbstractSession session)
Initialize and set the descriptor for the referenced class in this mapping.
|
protected void |
initializeSelectionQuery(AbstractSession session)
A subclass should implement this method if it wants non default behaviour.
|
boolean |
isAttributeValueInstantiated(Object object)
INTERNAL:
The referenced object is checked if it is instantiated or not
|
boolean |
isCascadeMerge()
PUBLIC:
Check cascading value for the MERGE operation.
|
boolean |
isCascadePersist()
PUBLIC:
Check cascading value for the CREATE operation.
|
boolean |
isCascadeRefresh()
PUBLIC:
Check cascading value for the REFRESH operation.
|
boolean |
isCascadeRemove()
PUBLIC:
Check cascading value for the REMOVE operation.
|
boolean |
isForeignReferenceMapping()
INTERNAL:
|
boolean |
isPrivateOwned()
INTERNAL:
Return true if referenced objects are provately owned else false.
|
void |
iterate(DescriptorIterator iterator)
INTERNAL:
Iterate on the iterator's current object's attribute defined by this mapping.
|
abstract void |
iterateOnRealAttributeValue(DescriptorIterator iterator,
Object realAttributeValue)
INTERNAL:
Iterate on the attribute value.
|
protected ReadQuery |
prepareHistoricalQuery(ReadQuery targetQuery,
ObjectLevelReadQuery sourceQuery,
AbstractSession executionSession)
INTERNAL:
Allow for the mapping to perform any historical query additions.
|
ObjectLevelReadQuery |
prepareNestedJoins(JoinedAttributeManager joinManager,
AbstractSession session)
INTERNAL:
Clone and prepare the JoinedAttributeManager nested JoinedAttributeManager.
|
void |
privateOwnedRelationship()
PUBLIC:
Sets the reference object to be a private owned.
|
void |
setCascadeAll(boolean value)
PUBLIC:
Sets the cascading for all operations.
|
void |
setCascadeMerge(boolean value)
PUBLIC:
Sets the cascading for the MERGE operation.
|
void |
setCascadePersist(boolean value)
PUBLIC:
Sets the cascading for the CREATE operation.
|
void |
setCascadeRefresh(boolean value)
PUBLIC:
Sets the cascading for the REFRESH operation.
|
void |
setCascadeRemove(boolean value)
PUBLIC:
Sets the cascading for the REMOVE operation.
|
void |
setCustomSelectionQuery(ReadQuery query)
PUBLIC:
Relationship mappings creates a read query to read reference objects.
|
protected void |
setHasCustomSelectionQuery(boolean bool) |
void |
setIndirectionPolicy(IndirectionPolicy indirectionPolicy)
ADVANCED:
Set the indirection policy.
|
void |
setIsPrivateOwned(boolean isPrivateOwned)
INTERNAL:
Used by Gromit
|
void |
setRealAttributeValueInObject(Object object,
Object value)
INTERNAL:
Set the value of the attribute mapped by this mapping,
placing it inside a value holder if necessary.
|
void |
setReferenceClass(Class referenceClass)
PUBLIC:
Set the referenced class.
|
void |
setReferenceClassName(String referenceClassName)
INTERNAL:
Used by MW.
|
protected void |
setReferenceDescriptor(ClassDescriptor aDescriptor)
Set the referenceDescriptor.
|
void |
setRelationshipPartner(DatabaseMapping mapping)
INTERNAL:
Sets the relationshipPartner mapping for this bi-directional mapping.
|
void |
setRelationshipPartnerAttributeName(String attributeName)
PUBLIC:
Use this method to specify the relationship partner attribute name of a bidirectional Mapping.
|
void |
setSelectionCall(Call call)
PUBLIC:
This is a property on the mapping which will allow custom call to be
substituted for reading a reference object.
|
void |
setSelectionCriteria(Expression anExpression)
PUBLIC:
Sets the selection criteria to be used as a where clause to read
reference objects.
|
protected void |
setSelectionQuery(ReadQuery aQuery)
Sets the query
|
void |
setSelectionSQLString(String sqlString)
PUBLIC:
This is a property on the mapping which will allow custom SQL to be
substituted for reading a reference object.
|
protected void |
setTempSession(AbstractSession session) |
void |
setUsesIndirection(boolean usesIndirection)
PUBLIC:
Indirection means that a ValueHolder will be put in-between the attribute and the real object.
|
protected boolean |
shouldInitializeSelectionCriteria() |
boolean |
shouldMergeCascadeParts(MergeManager mergeManager)
INTERNAL:
Returns true if the merge should cascade to the mappings reference's parts.
|
protected boolean |
shouldMergeCascadeReference(MergeManager mergeManager)
Returns true if the merge should cascade to the mappings reference.
|
protected boolean |
shouldObjectModifyCascadeToParts(ObjectLevelModifyQuery query)
Returns true if any process leading to object modification should also affect its parts
Usually used by write, insert and update.
|
protected boolean |
shouldObjectModifyCascadeToPartsForPreDelete(ObjectLevelModifyQuery query)
Return whether any process leading to object deletion should also affect its parts.
|
protected boolean |
shouldUseValueFromRowWithJoin(JoinedAttributeManager joinManager)
INTERNAL:
Indicates whether valueFromRow should call valueFromRowInternalWithJoin (true)
or valueFromRowInternal (false)
|
AbstractRecord |
trimRowForJoin(AbstractRecord row,
JoinedAttributeManager joinManager,
AbstractSession executionSession)
INTERNAL:
|
AbstractRecord |
trimRowForJoin(AbstractRecord row,
Object value,
AbstractSession executionSession)
INTERNAL:
|
void |
useBasicIndirection()
PUBLIC:
Indirection means that a ValueHolder will be put in-between the attribute and the real object.
|
boolean |
usesIndirection()
PUBLIC:
Indirection means that some sort of indirection object will be put in-between the attribute and the real object.
|
void |
useWeavedIndirection(String setMethodName) |
void |
validateBeforeInitialization(AbstractSession session)
INTERNAL:
To validate mappings decleration
|
Object |
valueFromRow(AbstractRecord row,
JoinedAttributeManager joinManager,
ObjectBuildingQuery query,
AbstractSession executionSession)
INTERNAL:
Return the value of the reference attribute or a value holder.
|
protected Object |
valueFromRowInternal(AbstractRecord row,
JoinedAttributeManager joinManager,
AbstractSession executionSession)
INTERNAL:
Return the value of the reference attribute or a value holder.
|
protected Object |
valueFromRowInternalWithJoin(AbstractRecord row,
JoinedAttributeManager joinManager,
AbstractSession executionSession)
INTERNAL:
If the query used joining or partial attributes, build the target object directly.
|
addToCollectionChangeRecord, buildChangeRecord, buildCopy, buildObjectJoinExpression, buildObjectJoinExpression, buildShallowOriginalFromRow, calculateDeferredChanges, cascadeMerge, cascadePerformRemoveIfRequired, cascadeRegisterNewIfRequired, cloneFields, collectFields, compareForChange, extractNestedExpressions, getAttributeAccessor, getAttributeClassification, getAttributeName, getContainerPolicy, getDescriptor, getField, getFieldClassification, getFields, getGetMethodName, getProperties, getProperty, getRealCollectionAttributeValueFromObject, getReferenceClassDescriptor, getSetMethodName, getWeight, hasConstraintDependency, hasDependency, hasInverseConstraintDependency, isAbstractCompositeCollectionMapping, isAbstractCompositeDirectCollectionMapping, isAbstractCompositeObjectMapping, isAbstractDirectMapping, isAggregateCollectionMapping, isAggregateMapping, isAggregateObjectMapping, isCascadedLockingSupported, isChangeTrackingSupported, isCloningRequired, isCollectionMapping, isDatabaseMapping, isDirectCollectionMapping, isDirectMapMapping, isDirectToFieldMapping, isDirectToXMLTypeMapping, isEISMapping, isJoiningSupported, isManyToManyMapping, isNestedTableMapping, isObjectReferenceMapping, isObjectTypeMapping, isOneToManyMapping, isOneToOneMapping, isOptional, isPrimaryKeyMapping, isReadOnly, isReferenceMapping, isRelationalMapping, isRemotelyInitialized, isSerializedObjectMapping, isStructureMapping, isTransformationMapping, isTypeConversionMapping, isUsingMethodAccess, isVariableOneToOneMapping, isWriteOnly, isXMLMapping, mergeChangesIntoObject, mergeIntoObject, performDataModificationEvent, postDelete, postInitialize, postInsert, postUpdate, preDelete, preInitialize, preInsert, prepareCascadeLockingPolicy, preUpdate, readFromRowIntoObject, readFromRowIntoObject, readOnly, readWrite, rehashFieldDependancies, removeFromCollectionChangeRecord, setAttributeAccessor, setAttributeName, setAttributeValueInObject, setDescriptor, setFields, setGetMethodName, setIsOptional, setIsPrimaryKeyMapping, setIsReadOnly, setProperties, setProperty, setSetMethodName, setWeight, simpleAddToCollectionChangeRecord, simpleRemoveFromCollectionChangeRecord, toString, updateChangeRecord, validateAfterInitialization, valueFromObject, valueFromRow, verifyDelete, writeFromAttributeIntoRow, writeFromObjectIntoRow, writeFromObjectIntoRowForShallowDelete, writeFromObjectIntoRowForShallowInsert, writeFromObjectIntoRowForShallowInsertWithChangeRecord, writeFromObjectIntoRowForUpdate, writeFromObjectIntoRowForWhereClause, writeFromObjectIntoRowWithChangeRecord, writeInsertFieldsIntoRow, writeUpdateFieldsIntoRow
protected Class referenceClass
protected String referenceClassName
protected transient AbstractSession tempInitSession
protected transient ClassDescriptor referenceDescriptor
protected transient ReadQuery selectionQuery
protected boolean isPrivateOwned
protected IndirectionPolicy indirectionPolicy
protected transient boolean hasCustomSelectionQuery
protected DatabaseMapping relationshipPartner
protected String relationshipPartnerAttributeName
protected boolean cascadePersist
protected boolean cascadeMerge
protected boolean cascadeRefresh
protected boolean cascadeRemove
public void buildBackupClone(Object clone, Object backup, UnitOfWorkImpl unitOfWork)
buildBackupClone
in class DatabaseMapping
public abstract Object buildBackupCloneForPartObject(Object attributeValue, Object clone, Object backup, UnitOfWorkImpl unitOfWork)
buildBackupCloneForPartObject
in class DatabaseMapping
public void buildClone(Object original, Object clone, UnitOfWorkImpl unitOfWork, JoinedAttributeManager joinedAttributeManager)
buildClone
in class DatabaseMapping
public void buildCloneFromRow(AbstractRecord databaseRow, JoinedAttributeManager joinManager, Object clone, ObjectBuildingQuery sourceQuery, UnitOfWorkImpl unitOfWork, AbstractSession executionSession)
buildClone assumes the attribute value exists on the original and can simply be copied.
readFromRowIntoObject assumes that one is building an original.
Both of the above assumptions are false in this method, and actually attempts to do both at the same time.
Extract value from the row and set the attribute to this value in the working copy clone. In order to bypass the shared cache when in transaction a UnitOfWork must be able to populate working copies directly from the row.
buildCloneFromRow
in class DatabaseMapping
public abstract Object buildCloneForPartObject(Object attributeValue, Object original, Object clone, UnitOfWorkImpl unitOfWork, boolean isExisting)
buildCloneForPartObject
in class DatabaseMapping
public Object clone()
clone
in class DatabaseMapping
public boolean compareObjects(Object firstObject, Object secondObject, AbstractSession session)
compareObjects
in class DatabaseMapping
protected abstract boolean compareObjectsWithoutPrivateOwned(Object first, Object second, AbstractSession session)
protected abstract boolean compareObjectsWithPrivateOwned(Object first, Object second, AbstractSession session)
public void convertClassNamesToClasses(ClassLoader classLoader)
convertClassNamesToClasses
in class DatabaseMapping
classLoader
- public UnitOfWorkValueHolder createUnitOfWorkValueHolder(ValueHolderInterface attributeValue, Object original, Object clone, AbstractRecord row, UnitOfWorkImpl unitOfWork, boolean buildDirectlyFromRow)
createUnitOfWorkValueHolder
in class DatabaseMapping
buildDirectlyFromRow
- indicates that we are building the clone directly
from a row as opposed to building the original from the row, putting it in
the shared cache, and then cloning the original.protected boolean dontDoMerge(Object target, Object source, MergeManager mergeManager)
public void dontUseIndirection()
public ObjectLevelReadQuery prepareNestedJoins(JoinedAttributeManager joinManager, AbstractSession session)
public Object getAttributeValueFromObject(Object object) throws DescriptorException
getAttributeValueFromObject
in class DatabaseMapping
DescriptorException
public Object getAttributeValueWithClonedValueHolders(Object object)
public IndirectionPolicy getIndirectionPolicy()
public Expression getJoinCriteria(QueryKeyExpression exp)
public Object getRealAttributeValueFromObject(Object object, AbstractSession session)
getRealAttributeValueFromObject
in class DatabaseMapping
public Class getReferenceClass()
public String getReferenceClassName()
public ClassDescriptor getReferenceDescriptor()
getReferenceDescriptor
in class DatabaseMapping
public DatabaseMapping getRelationshipPartner()
getRelationshipPartner
in class DatabaseMapping
public String getRelationshipPartnerAttributeName()
public Expression getSelectionCriteria()
public ReadQuery getSelectionQuery()
protected AbstractSession getTempSession()
public boolean hasCustomSelectionQuery()
public void initialize(AbstractSession session) throws DescriptorException
initialize
in class DatabaseMapping
DescriptorException
protected void initializeReferenceDescriptor(AbstractSession session) throws DescriptorException
DescriptorException
protected void initializeSelectionQuery(AbstractSession session) throws DescriptorException
DescriptorException
public boolean isAttributeValueInstantiated(Object object)
public boolean isCascadePersist()
public boolean isCascadeMerge()
public boolean isCascadeRefresh()
public boolean isCascadeRemove()
public boolean isForeignReferenceMapping()
isForeignReferenceMapping
in class DatabaseMapping
public boolean isPrivateOwned()
isPrivateOwned
in class DatabaseMapping
public void iterate(DescriptorIterator iterator)
iterate
in class DatabaseMapping
public abstract void iterateOnRealAttributeValue(DescriptorIterator iterator, Object realAttributeValue)
iterateOnRealAttributeValue
in class DatabaseMapping
public void privateOwnedRelationship()
public void setCascadeAll(boolean value)
public void setCascadePersist(boolean value)
public void setCascadeMerge(boolean value)
public void setCascadeRefresh(boolean value)
public void setCascadeRemove(boolean value)
public void setCustomSelectionQuery(ReadQuery query)
protected void setHasCustomSelectionQuery(boolean bool)
public void setIndirectionPolicy(IndirectionPolicy indirectionPolicy)
public void setIsPrivateOwned(boolean isPrivateOwned)
public void setRealAttributeValueInObject(Object object, Object value) throws DescriptorException
setRealAttributeValueInObject
in class DatabaseMapping
DescriptorException
public void setReferenceClass(Class referenceClass)
public void setReferenceClassName(String referenceClassName)
protected void setReferenceDescriptor(ClassDescriptor aDescriptor)
public void setRelationshipPartner(DatabaseMapping mapping)
public void setRelationshipPartnerAttributeName(String attributeName)
public void setSelectionCriteria(Expression anExpression)
protected void setSelectionQuery(ReadQuery aQuery)
public void setSelectionSQLString(String sqlString)
public void setSelectionCall(Call call)
protected void setTempSession(AbstractSession session)
public void setUsesIndirection(boolean usesIndirection)
useBasicIndirection()
,
dontUseIndirection()
protected boolean shouldInitializeSelectionCriteria()
public boolean shouldMergeCascadeParts(MergeManager mergeManager)
protected boolean shouldMergeCascadeReference(MergeManager mergeManager)
protected boolean shouldObjectModifyCascadeToParts(ObjectLevelModifyQuery query)
protected boolean shouldObjectModifyCascadeToPartsForPreDelete(ObjectLevelModifyQuery query)
public void useBasicIndirection()
public void useWeavedIndirection(String setMethodName)
public boolean usesIndirection()
public void validateBeforeInitialization(AbstractSession session) throws DescriptorException
validateBeforeInitialization
in class DatabaseMapping
DescriptorException
public Object valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery query, AbstractSession executionSession) throws DatabaseException
valueFromRow
in class DatabaseMapping
DatabaseException
protected boolean shouldUseValueFromRowWithJoin(JoinedAttributeManager joinManager)
protected Object valueFromRowInternalWithJoin(AbstractRecord row, JoinedAttributeManager joinManager, AbstractSession executionSession) throws DatabaseException
DatabaseException
protected Object valueFromRowInternal(AbstractRecord row, JoinedAttributeManager joinManager, AbstractSession executionSession) throws DatabaseException
DatabaseException
protected ReadQuery prepareHistoricalQuery(ReadQuery targetQuery, ObjectLevelReadQuery sourceQuery, AbstractSession executionSession)
public AbstractRecord trimRowForJoin(AbstractRecord row, JoinedAttributeManager joinManager, AbstractSession executionSession)
public AbstractRecord trimRowForJoin(AbstractRecord row, Object value, AbstractSession executionSession)
Copyright © 2024. All rights reserved.