Top Description Fields Constructors Methods
org.eclipse.persistence.internal.jpa.metadata.accessors.mappings

public abstract Class RelationshipAccessor

extends MappingAccessor
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.CollectionAccessor, org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.ObjectAccessor
Static Imports
org.eclipse.persistence.internal.jpa.metadata.MetadataConstants.JPA_COLUMN, .MetadataConstants.JPA_FETCH_LAZY, .MetadataConstants.JPA_JOIN_COLUMN, .MetadataConstants.JPA_JOIN_COLUMNS, .MetadataConstants.JPA_JOIN_TABLE

INTERNAL: A relational accessor. Key notes: - any metadata mapped from XML to this class must be compared in the equals method. - any metadata mapped from XML to this class must be handled in the merge method. (merging is done at the accessor/mapping level) - any metadata mapped from XML to this class must be initialized in the initXMLObject method. - methods should be preserved in alphabetical order.
Author
Guy Pelletier
Since
TopLink EJB 3.0 Reference Implementation

Field Summary

Modifier and TypeField and Description
private BatchFetchMetadata
private CascadeMetadata
private Boolean
private String
private ForeignKeyMetadata
private List<JoinColumnMetadata>
private String
private List<JoinFieldMetadata>
private JoinTableMetadata
private String
private Boolean
private Boolean
private Boolean
protected MetadataClass
private MetadataClass
private String
Inherited from org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor:
KEY_DOT_NOTATIONm_fieldVALUE_DOT_NOTATION

Constructor Summary

AccessConstructor and Description
protected
RelationshipAccessor(String xmlElement)

INTERNAL:

protected
RelationshipAccessor(MetadataAnnotation annotation, MetadataAccessibleObject accessibleObject, ClassAccessor classAccessor)

INTERNAL:

Method Summary

Modifier and TypeMethod and Description
protected void
addJoinTableRelationKeyFields(List<JoinColumnMetadata> joinColumns, RelationTableMechanism mechanism, String defaultFieldName, MetadataDescriptor descriptor, boolean isSource)

INTERNAL: Add the relation key fields to a many to many mapping.

public boolean
equals(Object
the reference object with which to compare.
objectToCompare
)

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.equals.

INTERNAL:
public BatchFetchMetadata
getBatchFetch()

INTERNAL: Used for OX mapping.

public CascadeMetadata
getCascade()

INTERNAL: Used for OX mapping.

public Boolean
getCascadeOnDelete()

INTERNAL: Used for OX mapping.

public abstract String
protected DatabaseTable
getDefaultTableForEntityMapKey()

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.getDefaultTableForEntityMapKey.

INTERNAL: Return the default table to hold the foreign key of a MapKey when and Entity is used as the MapKey
public String
getFetch()

INTERNAL: Used for OX mapping.

public ForeignKeyMetadata
getForeignKey()

INTERNAL: Used for OX mapping.

public List<JoinColumnMetadata>
getJoinColumns()

INTERNAL: Used for OX mapping.

public String
getJoinFetch()

INTERNAL: Used for OX mapping.

public List<JoinFieldMetadata>
getJoinFields()

INTERNAL: Used for OX mapping.

public JoinTableMetadata
getJoinTable()

INTERNAL: Used for OX mapping.

protected JoinTableMetadata
getJoinTableMetadata()

INTERNAL: This method will return the join table metadata to be processed with this relationship accessor.

protected abstract String
getLoggingContext()

INTERNAL: Return the logging context for this accessor.

public String
getMappedBy()

INTERNAL: Used for OX mapping.

public Boolean
getNonCacheable()

INTERNAL: Used for OX mapping.

public Boolean
getOrphanRemoval()

INTERNAL: Used for OX mapping.

protected DatabaseMapping
getOwningMapping()

INTERNAL: Method to return an owner mapping.

public Boolean
getPrivateOwned()

INTERNAL: Used for OX mapping.

public MetadataDescriptor
getReferenceDescriptor()

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.getReferenceDescriptor.

INTERNAL: Return the reference metadata descriptor for this accessor.
public MetadataClass
getTargetEntity()

INTERNAL: Return the target entity for this accessor.

public String
getTargetEntityName()

INTERNAL: Used for OX mapping.

public int
protected boolean
hasJoinTable()

INTERNAL: Return true if a join table exists for this accessor (either directly set or through an association override).

public boolean
hasMappedBy()

INTERNAL: Return true if this accessor is the non owning side of the relationship, that is, has a mapped by value.

public void
public boolean
isCascadeOnDelete()

INTERNAL:

public boolean
isLazy()

INTERNAL: Return if the accessor should be lazy fetched.

public boolean
isNonCacheable()

INTERNAL: Used for OX mapping.

protected boolean
isOrphanRemoval()

INTERNAL: Return true is this relationship employs orphanRemoval.

public boolean
isPrivateOwned()

INTERNAL: Used for OX mapping.

public boolean
isValueHolderInterface()

INTERNAL: If somehow we are processing a class that was weaved to have value holders, we should ignore the processing of this mapping.

public void
process()

Implements abstract org.eclipse.persistence.internal.jpa.metadata.accessors.MetadataAccessor.process.

INTERNAL: Common validation done by all relationship accessors.
protected void
processBatchFetch(ForeignReferenceMapping mapping)

INTERNAL: Set the batch fetch type on the foreign reference mapping.

protected void
protected void
processJoinTable(ForeignReferenceMapping mapping, RelationTableMechanism mechanism, JoinTableMetadata joinTable)

INTERNAL: Process a MetadataJoinTable.

protected void
protected void
processOrphanRemoval(ForeignReferenceMapping mapping)

INTERNAL: This method should be called for all mappings even though they may not support.

protected void
processRelationshipMapping(ForeignReferenceMapping mapping)

INTERNAL: Process settings common to ForeignReferenceMapping.

protected void
setAccessorMethods(DatabaseMapping mapping)

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.setAccessorMethods.

INTERNAL: Set the getter and setter access methods for this accessor.
public void
setBatchFetch(BatchFetchMetadata batchFetch)

INTERNAL: Used for OX mapping.

public void
setCascade(CascadeMetadata cascade)

INTERNAL: Used for OX mapping.

public void
setCascadeOnDelete(Boolean cascadeOnDelete)

INTERNAL: Used for OX mapping.

public void
setFetch(String fetch)

INTERNAL: Used for OX mapping.

public void
setForeignKey(ForeignKeyMetadata foreignKey)

INTERNAL: Used for OX mapping.

public void
setJoinColumns(List<JoinColumnMetadata> joinColumns)

INTERNAL: Used for OX mapping.

public void
setJoinFetch(String joinFetch)

INTERNAL: Used for OX mapping.

public void
setJoinFields(List<JoinFieldMetadata> joinFields)

INTERNAL: Used for OX mapping.

public void
setJoinTable(JoinTableMetadata joinTable)

INTERNAL: Used for OX mapping.

public void
setMappedBy(String mappedBy)

INTERNAL: Used for OX mapping.

public void
setNonCacheable(Boolean noncacheable)

INTERNAL: Used for OX mapping.

public void
setOrphanRemoval(Boolean orphanRemoval)

INTERNAL: Used for OX mapping.

public void
setPrivateOwned(Boolean privateOwned)

INTERNAL: Used for OX mapping.

public void
setTargetEntity(MetadataClass targetEntity)

INTERNAL:

public void
setTargetEntityName(String targetEntityName)

INTERNAL: Used for OX mapping.

protected boolean
Inherited from org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor:
addConvertaddConvertMetadataaddFieldNameTranslationaddMapKeyConvertderivesIdgetAnnotationgetAssociationOverridesgetAttributeNamegetAttributeOverridegetAttributeOverridesgetAttributeTypegetClassAccessorgetColumngetConvertsgetDatabaseFieldgetEnumeratedgetFieldgetForeignKeygetGetMethodNamegetJoinColumnsgetJoinColumnsAndValidategetLobgetMapKeygetMapKeyConvertsgetMapKeyReferenceClassgetMapKeyReferenceClassNamegetMapKeyReferenceClassWithGenericsgetMappinggetOwningDescriptorgetOwningDescriptorsgetRawClassgetRawClassWithGenericsgetReferenceAccessorsgetReferenceClassgetReferenceClassFromGenericgetReferenceClassNamegetReferenceClassWithGenericsgetReferenceDatabaseTablegetSetMethodNamegetTemporalhasAttributeOverridehasAttributeTypehasEnumeratedhasLobhasMapKeyhasReturnInserthasReturnUpdatehasTemporalinitXMLMappingAccessorisAnnotationPresentisBasicisBasicCollectionisBasicMapisCollectionAccessorisDerivedIdClassisDirectCollectionisDirectEmbeddableCollectionisEmbeddedisEmbeddedIdisEnumeratedisIdisJsonisLobisManyToManyisManyToOneisMapAccessorisMappedKeyMapAccessorisMultitenantIdisOneToManyisOneToOneisPrimitiveWrapperClassisProcessedisRelationshipisSerializedisTemporalisTimeClassisTransientisUUIDisValidJsonTypeisValidSerializedTypeisVariableOneToOneprocessAssociationOverrideprocessAssociationOverridesprocessAttributeOverridesprocessContainerPolicyAndIndirectionprocessConvertprocessConvertsprocessDirectMapKeyClassprocessEmbeddableMapKeyClassprocessEntityMapKeyClassprocessEnumeratedprocessForeignKeyRelationshipprocessIndirectionprocessJoinFetchprocessJsonprocessLobprocessMapKeyClassprocessMappingConverterprocessMappingKeyConverterprocessMappingValueConverterprocessPropertiesprocessPropertyprocessReturnInsertprocessReturnInsertAndUpdateprocessReturnUpdateprocessSerializedprocessSerializedprocessTemporalprocessUUIDsetAttributeTypesetClassAccessorsetFieldsetIndirectionPolicysetMappingsetOverrideMappingsetTemporaltoStringupdatePrimaryKeyFieldusesFieldAccessusesPropertyAccessusesVirtualAccess

Field Detail

m_batchFetchback to summary
private BatchFetchMetadata m_batchFetch
m_cascadeback to summary
private CascadeMetadata m_cascade
m_cascadeOnDeleteback to summary
private Boolean m_cascadeOnDelete
m_fetchback to summary
private String m_fetch
m_foreignKeyback to summary
private ForeignKeyMetadata m_foreignKey
m_joinColumnsback to summary
private List<JoinColumnMetadata> m_joinColumns
m_joinFetchback to summary
private String m_joinFetch
m_joinFieldsback to summary
private List<JoinFieldMetadata> m_joinFields
m_joinTableback to summary
private JoinTableMetadata m_joinTable
m_mappedByback to summary
private String m_mappedBy
m_nonCacheableback to summary
private Boolean m_nonCacheable
m_orphanRemovalback to summary
private Boolean m_orphanRemoval
m_privateOwnedback to summary
private Boolean m_privateOwned
m_referenceClassback to summary
protected MetadataClass m_referenceClass
m_targetEntityback to summary
private MetadataClass m_targetEntity
m_targetEntityNameback to summary
private String m_targetEntityName

Constructor Detail

RelationshipAccessorback to summary
protected RelationshipAccessor(String xmlElement)

INTERNAL:

RelationshipAccessorback to summary
protected RelationshipAccessor(MetadataAnnotation annotation, MetadataAccessibleObject accessibleObject, ClassAccessor classAccessor)

INTERNAL:

Method Detail

addJoinTableRelationKeyFieldsback to summary
protected void addJoinTableRelationKeyFields(List<JoinColumnMetadata> joinColumns, RelationTableMechanism mechanism, String defaultFieldName, MetadataDescriptor descriptor, boolean isSource)

INTERNAL: Add the relation key fields to a many to many mapping.

equalsback to summary
public boolean equals(Object objectToCompare)

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.equals.

INTERNAL:

Parameters
objectToCompare:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

Doc from java.lang.Object.equals.

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getBatchFetchback to summary
public BatchFetchMetadata getBatchFetch()

INTERNAL: Used for OX mapping.

getCascadeback to summary
public CascadeMetadata getCascade()

INTERNAL: Used for OX mapping.

getCascadeOnDeleteback to summary
public Boolean getCascadeOnDelete()

INTERNAL: Used for OX mapping.

getDefaultFetchTypeback to summary
public abstract String getDefaultFetchType()

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.getDefaultFetchType.

INTERNAL:

Annotations
@Override
getDefaultTableForEntityMapKeyback to summary
protected DatabaseTable getDefaultTableForEntityMapKey()

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.getDefaultTableForEntityMapKey.

INTERNAL: Return the default table to hold the foreign key of a MapKey when and Entity is used as the MapKey

Annotations
@Override
getFetchback to summary
public String getFetch()

INTERNAL: Used for OX mapping.

getForeignKeyback to summary
public ForeignKeyMetadata getForeignKey()

INTERNAL: Used for OX mapping.

getJoinColumnsback to summary
public List<JoinColumnMetadata> getJoinColumns()

INTERNAL: Used for OX mapping.

getJoinFetchback to summary
public String getJoinFetch()

INTERNAL: Used for OX mapping.

getJoinFieldsback to summary
public List<JoinFieldMetadata> getJoinFields()

INTERNAL: Used for OX mapping.

getJoinTableback to summary
public JoinTableMetadata getJoinTable()

INTERNAL: Used for OX mapping.

getJoinTableMetadataback to summary
protected JoinTableMetadata getJoinTableMetadata()

INTERNAL: This method will return the join table metadata to be processed with this relationship accessor. It will first check for a join table from an association override, followed by a join table defined directly on the accessor. If neither is present, a join table metadata is defaulted.

getLoggingContextback to summary
protected abstract String getLoggingContext()

INTERNAL: Return the logging context for this accessor.

getMappedByback to summary
public String getMappedBy()

INTERNAL: Used for OX mapping.

getNonCacheableback to summary
public Boolean getNonCacheable()

INTERNAL: Used for OX mapping.

getOrphanRemovalback to summary
public Boolean getOrphanRemoval()

INTERNAL: Used for OX mapping.

getOwningMappingback to summary
protected DatabaseMapping getOwningMapping()

INTERNAL: Method to return an owner mapping. It will tell the owner class to process itself if it hasn't already done so. Assumes that a mapped by value has been specified and that a check against mappedBy has been done.

getPrivateOwnedback to summary
public Boolean getPrivateOwned()

INTERNAL: Used for OX mapping.

getReferenceDescriptorback to summary
public MetadataDescriptor getReferenceDescriptor()

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.getReferenceDescriptor.

INTERNAL: Return the reference metadata descriptor for this accessor. This method does additional checks to make sure that the target entity is indeed an entity class.

Annotations
@Override
getTargetEntityback to summary
public MetadataClass getTargetEntity()

INTERNAL: Return the target entity for this accessor.

getTargetEntityNameback to summary
public String getTargetEntityName()

INTERNAL: Used for OX mapping.

hashCodeback to summary
public int hashCode()

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
hasJoinTableback to summary
protected boolean hasJoinTable()

INTERNAL: Return true if a join table exists for this accessor (either directly set or through an association override).

hasMappedByback to summary
public boolean hasMappedBy()

INTERNAL: Return true if this accessor is the non owning side of the relationship, that is, has a mapped by value.

initXMLObjectback to summary
public void initXMLObject(MetadataAccessibleObject accessibleObject, XMLEntityMappings entityMappings)

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.initXMLObject.

INTERNAL:

Annotations
@Override
isCascadeOnDeleteback to summary
public boolean isCascadeOnDelete()

INTERNAL:

isLazyback to summary
public boolean isLazy()

INTERNAL: Return if the accessor should be lazy fetched.

isNonCacheableback to summary
public boolean isNonCacheable()

INTERNAL: Used for OX mapping.

isOrphanRemovalback to summary
protected boolean isOrphanRemoval()

INTERNAL: Return true is this relationship employs orphanRemoval.

isPrivateOwnedback to summary
public boolean isPrivateOwned()

INTERNAL: Used for OX mapping.

isValueHolderInterfaceback to summary
public boolean isValueHolderInterface()

INTERNAL: If somehow we are processing a class that was weaved to have value holders, we should ignore the processing of this mapping.

processback to summary
public void process()

Implements abstract org.eclipse.persistence.internal.jpa.metadata.accessors.MetadataAccessor.process.

INTERNAL: Common validation done by all relationship accessors.

Annotations
@Override
processBatchFetchback to summary
protected void processBatchFetch(ForeignReferenceMapping mapping)

INTERNAL: Set the batch fetch type on the foreign reference mapping.

processCascadeTypesback to summary
protected void processCascadeTypes(ForeignReferenceMapping mapping)

INTERNAL:

processJoinTableback to summary
protected void processJoinTable(ForeignReferenceMapping mapping, RelationTableMechanism mechanism, JoinTableMetadata joinTable)

INTERNAL: Process a MetadataJoinTable.

processMappedByRelationTableback to summary
protected void processMappedByRelationTable(RelationTableMechanism ownerMechanism, RelationTableMechanism mechanism)

INTERNAL:

processOrphanRemovalback to summary
protected void processOrphanRemoval(ForeignReferenceMapping mapping)

INTERNAL: This method should be called for all mappings even though they may not support. The reason is that we want to log a message for those mappings that try to employ a private owned setting when it is not supported on their mapping. Order of checking is as follows: 1 - check for orphanRemoval first. Through meta data, this can only be true for 1-1, 1-M and V1-1 2 - check for isPrivateOwned. Do no check the variable directly as the isPrivateOwned method is overridden in those classes that do not support it (to check if the user decorated the mapping with a private owned and log a warning message that we are ignoring it.)

processRelationshipMappingback to summary
protected void processRelationshipMapping(ForeignReferenceMapping mapping)

INTERNAL: Process settings common to ForeignReferenceMapping.

setAccessorMethodsback to summary
protected void setAccessorMethods(DatabaseMapping mapping)

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.setAccessorMethods.

INTERNAL: Set the getter and setter access methods for this accessor.

Annotations
@Override
setBatchFetchback to summary
public void setBatchFetch(BatchFetchMetadata batchFetch)

INTERNAL: Used for OX mapping.

setCascadeback to summary
public void setCascade(CascadeMetadata cascade)

INTERNAL: Used for OX mapping.

setCascadeOnDeleteback to summary
public void setCascadeOnDelete(Boolean cascadeOnDelete)

INTERNAL: Used for OX mapping.

setFetchback to summary
public void setFetch(String fetch)

INTERNAL: Used for OX mapping.

setForeignKeyback to summary
public void setForeignKey(ForeignKeyMetadata foreignKey)

INTERNAL: Used for OX mapping.

setJoinColumnsback to summary
public void setJoinColumns(List<JoinColumnMetadata> joinColumns)

INTERNAL: Used for OX mapping.

setJoinFetchback to summary
public void setJoinFetch(String joinFetch)

INTERNAL: Used for OX mapping.

setJoinFieldsback to summary
public void setJoinFields(List<JoinFieldMetadata> joinFields)

INTERNAL: Used for OX mapping.

setJoinTableback to summary
public void setJoinTable(JoinTableMetadata joinTable)

INTERNAL: Used for OX mapping.

setMappedByback to summary
public void setMappedBy(String mappedBy)

INTERNAL: Used for OX mapping.

setNonCacheableback to summary
public void setNonCacheable(Boolean noncacheable)

INTERNAL: Used for OX mapping.

setOrphanRemovalback to summary
public void setOrphanRemoval(Boolean orphanRemoval)

INTERNAL: Used for OX mapping.

setPrivateOwnedback to summary
public void setPrivateOwned(Boolean privateOwned)

INTERNAL: Used for OX mapping.

setTargetEntityback to summary
public void setTargetEntity(MetadataClass targetEntity)

INTERNAL:

setTargetEntityNameback to summary
public void setTargetEntityName(String targetEntityName)

INTERNAL: Used for OX mapping.

usesIndirectionback to summary
protected boolean usesIndirection()

Overrides org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.usesIndirection.

INTERNAL:

Annotations
@Override