Class XMLInverseReferenceMapping

All Implemented Interfaces:
Serializable, Cloneable, InverseReferenceMapping<AbstractSession,AttributeAccessor,ContainerPolicy,ClassDescriptor,DatabaseField,DatabaseMapping,XMLRecord>, Mapping<AbstractSession,AttributeAccessor,ContainerPolicy,ClassDescriptor,DatabaseField,XMLRecord>, ContainerMapping

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

  • XMLCompositeObjectMapping
  • XMLCompositeCollectionMapping
  • XMLObjectReferenceMapping
  • XMLCollectionReferenceMapping
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: