EclipseLink 2.0.0, build 'v20091127-r5931' API Reference

org.eclipse.persistence.oxm.mappings
Class XMLInverseReferenceMapping

java.lang.Object
  extended by org.eclipse.persistence.mappings.DatabaseMapping
      extended by org.eclipse.persistence.mappings.AggregateMapping
          extended by org.eclipse.persistence.oxm.mappings.XMLInverseReferenceMapping
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, ContainerMapping

public class XMLInverseReferenceMapping
extends AggregateMapping
implements ContainerMapping

This mapping is used to map a back-pointer. It represents the "opposite" of one of the following relationship mappings:

When configuring an XMLInverseReferenceMapping, the "mappedBy" field must be set to the field on the reference class that maps to this Descriptor. For example:

// EMPLOYEE has a collection of PHONEs (phoneNumbers)
// PHONE has a back-pointer to EMPLOYEE (owningEmployee)

// EMPLOYEE Descriptor
XMLCompositeCollectionMapping phone = new XMLCompositeCollectionMapping();
phone.setReferenceClassName("org.example.PhoneNumber");
phone.setAttributeName("phoneNumbers");
...

// PHONE Descriptor
XMLInverseReferenceMapping owningEmployee = new XMLInverseReferenceMapping();
owningEmployee.setReferenceClassName("org.example.Employee");
owningEmployee.setMappedBy("phoneNumbers");
owningEmployee.setAttributeName("owningEmployee");
...

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.eclipse.persistence.mappings.AggregateMapping
referenceClass, referenceClassName, referenceDescriptor
 
Fields inherited from class org.eclipse.persistence.mappings.DatabaseMapping
attributeAccessor, attributeName, derivedIdMapping, derivesId, descriptor, fields, isJPAId, isLazy, isMapKeyMapping, isOptional, isPrimaryKeyMapping, isReadOnly, isRemotelyInitialized, mapsIdValue, NO_FIELDS, NO_WEIGHT, properties, weight, WEIGHT_1
 
Constructor Summary
XMLInverseReferenceMapping()
           
 
Method Summary
 void buildBackupClone(java.lang.Object clone, java.lang.Object backup, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork)
          INTERNAL: Clone the attribute from the clone and assign it to the backup.
 void buildClone(java.lang.Object original, java.lang.Object clone, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork)
          INTERNAL: Clone the attribute from the original and assign it to the clone.
 void buildCloneFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, java.lang.Object clone, ObjectBuildingQuery sourceQuery, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
          INTERNAL: A combination of readFromRowIntoObject and buildClone.
 void cascadePerformRemoveIfRequired(java.lang.Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, java.util.Map visitedObjects)
          INTERNAL: Cascade registerNew for Create through mappings that require the cascade
 void cascadeRegisterNewIfRequired(java.lang.Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, java.util.Map visitedObjects)
          INTERNAL: Cascade registerNew for Create through mappings that require the cascade
 org.eclipse.persistence.internal.sessions.ChangeRecord compareForChange(java.lang.Object clone, java.lang.Object backup, org.eclipse.persistence.internal.sessions.ObjectChangeSet owner, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Compare the changes between two aggregates.
 boolean compareObjects(java.lang.Object firstObject, java.lang.Object secondObject, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Compare the attributes belonging to this mapping for the objects.
 void fixObjectReferences(java.lang.Object object, java.util.Map objectDescriptors, java.util.Map processedObjects, ObjectLevelReadQuery query, RemoteSession session)
          INTERNAL: An object has been serialized from the server to the remote client.
 org.eclipse.persistence.internal.queries.ContainerPolicy getContainerPolicy()
          INTERNAL: Return the mapping's containerPolicy.
 java.lang.String getMappedBy()
           
 void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Initialize the reference descriptor.
 boolean isXMLMapping()
          INTERNAL: All relational mappings should implement this method to return true.
 void iterate(org.eclipse.persistence.internal.descriptors.DescriptorIterator iterator)
          INTERNAL: Iterate on the appropriate attribute value.
 void mergeChangesIntoObject(java.lang.Object target, org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord, java.lang.Object source, org.eclipse.persistence.internal.sessions.MergeManager mergeManager)
          INTERNAL: Merge changes from the source to the target object.
 void mergeIntoObject(java.lang.Object target, boolean isTargetUninitialized, java.lang.Object source, org.eclipse.persistence.internal.sessions.MergeManager mergeManager)
          INTERNAL: Merge changes from the source to the target object.
 void postInitialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Allow for initialization of properties and validation that have dependecies no the descriptor being initialized.
 void setContainerPolicy(org.eclipse.persistence.internal.queries.ContainerPolicy containerPolicy)
          PUBLIC: Set the mapping's container policy.
 void setMappedBy(java.lang.String mappedBy)
           
 void useCollectionClass(java.lang.Class concreteClass)
          PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.
 void useMapClass(java.lang.Class concreteClass, java.lang.String methodName)
          PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.
 
Methods inherited from class org.eclipse.persistence.mappings.AggregateMapping
buildAggregateDeleteQuery, buildAggregateModifyQuery, buildAggregateWriteQuery, buildBackupClonePart, buildClonePart, buildClonePart, buildCopy, buildCopyOfAttributeValue, buildExpression, buildNewMergeInstanceOf, compareAttributeValues, convertClassNamesToClasses, executeEvent, fixAttributeValue, getAttributeValueFromBackupClone, getObjectBuilder, getObjectBuilderForClass, getQueryManager, getReferenceClass, getReferenceClassName, getReferenceDescriptor, getReferenceDescriptor, getReferenceDescriptor, isAggregateMapping, iterateOnAttributeValue, mergeAttributeValue, postDelete, postDeleteAttributeValue, postInsert, postInsertAttributeValue, postUpdate, postUpdateAttributeValue, preDelete, preDeleteAttributeValue, preInsert, preInsertAttributeValue, preUpdate, preUpdateAttributeValue, remoteInitialization, setReferenceClass, setReferenceClassName, setReferenceDescriptor, updateChangeRecord, verifyDelete, verifyDeleteOfAttributeValue
 
Methods inherited from class org.eclipse.persistence.mappings.DatabaseMapping
buildBackupCloneForPartObject, buildChangeRecord, buildCloneForPartObject, buildObjectJoinExpression, buildObjectJoinExpression, buildShallowOriginalFromRow, calculateDeferredChanges, cascadeDiscoverAndPersistUnregisteredNewObjects, cascadeMerge, cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired, clone, cloneFields, collectFields, createUnitOfWorkValueHolder, derivesId, earlyPreDelete, extractNestedExpressions, fixRealObjectReferences, getAttributeAccessor, getAttributeClassification, getAttributeName, getAttributeValueFromObject, getDerivedIdMapping, getDescriptor, getField, getFieldClassification, getFields, getGetMethodName, getMapsIdValue, getObjectCorrespondingTo, getProperties, getProperty, getRealAttributeValueFromAttribute, getRealAttributeValueFromObject, getRealCollectionAttributeValueFromObject, getRelationshipPartner, getSelectFields, getSelectTables, getSetMethodName, getValueFromRemoteValueHolder, getWeight, hasConstraintDependency, hasDependency, hasInverseConstraintDependency, hasMapsIdValue, hasRootExpressionThatShouldUseOuterJoin, instantiateAttribute, isAbstractCompositeCollectionMapping, isAbstractCompositeDirectCollectionMapping, isAbstractCompositeObjectMapping, isAbstractDirectMapping, isAggregateCollectionMapping, isAggregateObjectMapping, isCandidateForPrivateOwnedRemoval, isCascadedLockingSupported, isChangeTrackingSupported, isCloningRequired, isCollectionMapping, isDatabaseMapping, isDirectCollectionMapping, isDirectMapMapping, isDirectToFieldMapping, isDirectToXMLTypeMapping, isEISMapping, isForeignReferenceMapping, isJoiningSupported, isJPAId, isLazy, isLockableMapping, isManyToManyMapping, isMapKeyMapping, isNestedTableMapping, isObjectReferenceMapping, isOneToManyMapping, isOneToOneMapping, isOptional, isOwned, isPrimaryKeyMapping, isPrivateOwned, isReadOnly, isReferenceMapping, isRelationalMapping, isRemotelyInitialized, isStructureMapping, isTransformationMapping, isUnidirectionalOneToManyMapping, isUsingMethodAccess, isVariableOneToOneMapping, isWriteOnly, iterateOnRealAttributeValue, performDataModificationEvent, postCalculateChanges, postCalculateChangesOnDeleted, preInitialize, prepareCascadeLockingPolicy, readFromResultSetIntoObject, readFromRowIntoObject, readOnly, readWrite, recordPrivateOwnedRemovals, rehashFieldDependancies, remotelyInitialized, replaceValueHoldersIn, setAttributeAccessor, setAttributeName, setAttributeValueInObject, setChangeListener, setDerivedIdMapping, setDerivesId, setDescriptor, setFields, setGetMethodName, setIsJPAId, setIsLazy, setIsMapKeyMapping, setIsOptional, setIsPrimaryKeyMapping, setIsReadOnly, setMapsIdValue, setProperties, setProperty, setRealAttributeValueInObject, setSetMethodName, setWeight, simpleAddToCollectionChangeRecord, simpleRemoveFromCollectionChangeRecord, toString, updateCollectionChangeRecord, validateAfterInitialization, validateBeforeInitialization, valueFromObject, valueFromResultSet, valueFromRow, valueFromRow, writeFromAttributeIntoRow, writeFromObjectIntoRow, writeFromObjectIntoRowForShallowInsert, writeFromObjectIntoRowForShallowInsertWithChangeRecord, writeFromObjectIntoRowForUpdate, writeFromObjectIntoRowForWhereClause, writeFromObjectIntoRowWithChangeRecord, writeInsertFieldsIntoRow, writeUpdateFieldsIntoRow
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XMLInverseReferenceMapping

public XMLInverseReferenceMapping()
Method Detail

isXMLMapping

public boolean isXMLMapping()
Description copied from class: DatabaseMapping
INTERNAL: All relational mappings should implement this method to return true.

Overrides:
isXMLMapping in class DatabaseMapping

initialize

public void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
                throws DescriptorException
Description copied from class: AggregateMapping
INTERNAL: Initialize the reference descriptor.

Overrides:
initialize in class AggregateMapping
Throws:
DescriptorException

postInitialize

public void postInitialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
                    throws DescriptorException
Description copied from class: DatabaseMapping
INTERNAL: Allow for initialization of properties and validation that have dependecies no the descriptor being initialized.

Overrides:
postInitialize in class DatabaseMapping
Throws:
DescriptorException

getMappedBy

public java.lang.String getMappedBy()

setMappedBy

public void setMappedBy(java.lang.String mappedBy)

buildBackupClone

public void buildBackupClone(java.lang.Object clone,
                             java.lang.Object backup,
                             org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork)
Description copied from class: AggregateMapping
INTERNAL: Clone the attribute from the clone and assign it to the backup.

Overrides:
buildBackupClone in class AggregateMapping

buildClone

public void buildClone(java.lang.Object original,
                       java.lang.Object clone,
                       org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork)
Description copied from class: AggregateMapping
INTERNAL: Clone the attribute from the original and assign it to the clone.

Overrides:
buildClone in class AggregateMapping

buildCloneFromRow

public void buildCloneFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                              org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager,
                              java.lang.Object clone,
                              ObjectBuildingQuery sourceQuery,
                              org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork,
                              org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
Description copied from class: AggregateMapping
INTERNAL: A combination of readFromRowIntoObject and buildClone.

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.

Overrides:
buildCloneFromRow in class AggregateMapping

cascadePerformRemoveIfRequired

public void cascadePerformRemoveIfRequired(java.lang.Object object,
                                           org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow,
                                           java.util.Map visitedObjects)
Description copied from class: DatabaseMapping
INTERNAL: Cascade registerNew for Create through mappings that require the cascade

Specified by:
cascadePerformRemoveIfRequired in class DatabaseMapping

cascadeRegisterNewIfRequired

public void cascadeRegisterNewIfRequired(java.lang.Object object,
                                         org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow,
                                         java.util.Map visitedObjects)
Description copied from class: DatabaseMapping
INTERNAL: Cascade registerNew for Create through mappings that require the cascade

Specified by:
cascadeRegisterNewIfRequired in class DatabaseMapping

compareForChange

public org.eclipse.persistence.internal.sessions.ChangeRecord compareForChange(java.lang.Object clone,
                                                                               java.lang.Object backup,
                                                                               org.eclipse.persistence.internal.sessions.ObjectChangeSet owner,
                                                                               org.eclipse.persistence.internal.sessions.AbstractSession session)
Description copied from class: AggregateMapping
INTERNAL: Compare the changes between two aggregates. Return a change record holding the changes.

Overrides:
compareForChange in class AggregateMapping
Returns:
prototype.changeset.ChangeRecord

compareObjects

public boolean compareObjects(java.lang.Object firstObject,
                              java.lang.Object secondObject,
                              org.eclipse.persistence.internal.sessions.AbstractSession session)
Description copied from class: AggregateMapping
INTERNAL: Compare the attributes belonging to this mapping for the objects.

Overrides:
compareObjects in class AggregateMapping

fixObjectReferences

public void fixObjectReferences(java.lang.Object object,
                                java.util.Map objectDescriptors,
                                java.util.Map processedObjects,
                                ObjectLevelReadQuery query,
                                RemoteSession session)
Description copied from class: AggregateMapping
INTERNAL: An object has been serialized from the server to the remote client. Replace the transient attributes of the remote value holders with client-side objects.

Overrides:
fixObjectReferences in class AggregateMapping

iterate

public void iterate(org.eclipse.persistence.internal.descriptors.DescriptorIterator iterator)
Description copied from class: AggregateMapping
INTERNAL: Iterate on the appropriate attribute value.

Overrides:
iterate in class AggregateMapping

mergeChangesIntoObject

public void mergeChangesIntoObject(java.lang.Object target,
                                   org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord,
                                   java.lang.Object source,
                                   org.eclipse.persistence.internal.sessions.MergeManager mergeManager)
Description copied from class: AggregateMapping
INTERNAL: Merge changes from the source to the target object. With aggregates the merge must cascade to the object changes for the aggregate object because aggregate objects have no identity outside of themselves. The actual aggregate object does not need to be replaced, because even if the clone references another aggregate it appears the same to TopLink

Overrides:
mergeChangesIntoObject in class AggregateMapping

mergeIntoObject

public void mergeIntoObject(java.lang.Object target,
                            boolean isTargetUninitialized,
                            java.lang.Object source,
                            org.eclipse.persistence.internal.sessions.MergeManager mergeManager)
Description copied from class: AggregateMapping
INTERNAL: Merge changes from the source to the target object. This merge is only called when a changeSet for the target does not exist or the target is uninitialized

Overrides:
mergeIntoObject in class AggregateMapping

setContainerPolicy

public void setContainerPolicy(org.eclipse.persistence.internal.queries.ContainerPolicy containerPolicy)
Description copied from interface: ContainerMapping
PUBLIC: Set the mapping's container policy.

Specified by:
setContainerPolicy in interface ContainerMapping

getContainerPolicy

public org.eclipse.persistence.internal.queries.ContainerPolicy getContainerPolicy()
Description copied from class: DatabaseMapping
INTERNAL: Return the mapping's containerPolicy.

Specified by:
getContainerPolicy in interface ContainerMapping
Overrides:
getContainerPolicy in class DatabaseMapping

useCollectionClass

public void useCollectionClass(java.lang.Class concreteClass)
Description copied from interface: ContainerMapping
PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.

The container class must implement (directly or indirectly) the java.util.Collection interface.

Specified by:
useCollectionClass in interface ContainerMapping

useMapClass

public void useMapClass(java.lang.Class concreteClass,
                        java.lang.String methodName)
Description copied from interface: ContainerMapping
PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects. The key used to index a value in the Map is the value returned by a call to the specified zero-argument method. The method must be implemented by the class (or a superclass) of any value to be inserted into the Map.

The container class must implement (directly or indirectly) the java.util.Map interface.

To facilitate resolving the method, the mapping's referenceClass must set before calling this method.

Specified by:
useMapClass in interface ContainerMapping

EclipseLink 2.0.0, build 'v20091127-r5931' API Reference