Class RelationshipAccessor

  • Direct Known Subclasses:
    CollectionAccessor, ObjectAccessor

    public abstract class RelationshipAccessor
    extends MappingAccessor
    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.
    Since:
    TopLink EJB 3.0 Reference Implementation
    Author:
    Guy Pelletier
    • Method Detail

      • addJoinTableRelationKeyFields

        protected void addJoinTableRelationKeyFields​(java.util.List<JoinColumnMetadata> joinColumns,
                                                     org.eclipse.persistence.mappings.RelationTableMechanism mechanism,
                                                     java.lang.String defaultFieldName,
                                                     MetadataDescriptor descriptor,
                                                     boolean isSource)
        INTERNAL: Add the relation key fields to a many to many mapping.
      • equals

        public boolean equals​(java.lang.Object objectToCompare)
        INTERNAL:
        Overrides:
        equals in class MappingAccessor
      • getBatchFetch

        public BatchFetchMetadata getBatchFetch()
        INTERNAL: Used for OX mapping.
      • getCascadeOnDelete

        public java.lang.Boolean getCascadeOnDelete()
        INTERNAL: Used for OX mapping.
      • getCascade

        public CascadeMetadata getCascade()
        INTERNAL: Used for OX mapping.
      • getDefaultTableForEntityMapKey

        protected org.eclipse.persistence.internal.helper.DatabaseTable getDefaultTableForEntityMapKey()
        INTERNAL: Return the default table to hold the foreign key of a MapKey when and Entity is used as the MapKey
        Overrides:
        getDefaultTableForEntityMapKey in class MappingAccessor
      • getFetch

        public java.lang.String getFetch()
        INTERNAL: Used for OX mapping.
      • getForeignKey

        public ForeignKeyMetadata getForeignKey()
        INTERNAL: Used for OX mapping.
      • getJoinColumns

        public java.util.List<JoinColumnMetadata> getJoinColumns()
        INTERNAL: Used for OX mapping.
      • getJoinFields

        public java.util.List<JoinFieldMetadata> getJoinFields()
        INTERNAL: Used for OX mapping.
      • getJoinFetch

        public java.lang.String getJoinFetch()
        INTERNAL: Used for OX mapping.
      • getJoinTable

        public JoinTableMetadata getJoinTable()
        INTERNAL: Used for OX mapping.
      • getJoinTableMetadata

        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.
      • getLoggingContext

        protected abstract java.lang.String getLoggingContext()
        INTERNAL: Return the logging context for this accessor.
      • getMappedBy

        public java.lang.String getMappedBy()
        INTERNAL: Used for OX mapping.
      • getNonCacheable

        public java.lang.Boolean getNonCacheable()
        INTERNAL: Used for OX mapping.
      • getOrphanRemoval

        public java.lang.Boolean getOrphanRemoval()
        INTERNAL: Used for OX mapping.
      • getOwningMapping

        protected org.eclipse.persistence.mappings.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.
      • getPrivateOwned

        public java.lang.Boolean getPrivateOwned()
        INTERNAL: Used for OX mapping.
      • getReferenceDescriptor

        public MetadataDescriptor 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.
        Overrides:
        getReferenceDescriptor in class MappingAccessor
      • getTargetEntity

        public MetadataClass getTargetEntity()
        INTERNAL: Return the target entity for this accessor.
      • getTargetEntityName

        public java.lang.String getTargetEntityName()
        INTERNAL: Used for OX mapping.
      • hasJoinTable

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

        public boolean hasMappedBy()
        INTERNAL: Return true if this accessor is the non owning side of the relationship, that is, has a mapped by value.
      • isCascadeOnDelete

        public boolean isCascadeOnDelete()
        INTERNAL:
      • isLazy

        public boolean isLazy()
        INTERNAL: Return if the accessor should be lazy fetched.
      • isNonCacheable

        public boolean isNonCacheable()
        INTERNAL: Used for OX mapping.
      • isOrphanRemoval

        protected boolean isOrphanRemoval()
        INTERNAL: Return true is this relationship employs orphanRemoval.
      • isPrivateOwned

        public boolean isPrivateOwned()
        INTERNAL: Used for OX mapping.
      • isValueHolderInterface

        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.
      • process

        public void process()
        INTERNAL: Common validation done by all relationship accessors.
        Specified by:
        process in class MetadataAccessor
      • processBatchFetch

        protected void processBatchFetch​(org.eclipse.persistence.mappings.ForeignReferenceMapping mapping)
        INTERNAL: Set the batch fetch type on the foreign reference mapping.
      • processCascadeTypes

        protected void processCascadeTypes​(org.eclipse.persistence.mappings.ForeignReferenceMapping mapping)
        INTERNAL:
      • processJoinTable

        protected void processJoinTable​(org.eclipse.persistence.mappings.ForeignReferenceMapping mapping,
                                        org.eclipse.persistence.mappings.RelationTableMechanism mechanism,
                                        JoinTableMetadata joinTable)
        INTERNAL: Process a MetadataJoinTable.
      • processMappedByRelationTable

        protected void processMappedByRelationTable​(org.eclipse.persistence.mappings.RelationTableMechanism ownerMechanism,
                                                    org.eclipse.persistence.mappings.RelationTableMechanism mechanism)
        INTERNAL:
      • processOrphanRemoval

        protected void processOrphanRemoval​(org.eclipse.persistence.mappings.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.)
      • processRelationshipMapping

        protected void processRelationshipMapping​(org.eclipse.persistence.mappings.ForeignReferenceMapping mapping)
        INTERNAL: Process settings common to ForeignReferenceMapping.
      • setAccessorMethods

        protected void setAccessorMethods​(org.eclipse.persistence.mappings.DatabaseMapping mapping)
        INTERNAL: Set the getter and setter access methods for this accessor.
        Overrides:
        setAccessorMethods in class MappingAccessor
      • setBatchFetch

        public void setBatchFetch​(BatchFetchMetadata batchFetch)
        INTERNAL: Used for OX mapping.
      • setCascade

        public void setCascade​(CascadeMetadata cascade)
        INTERNAL: Used for OX mapping.
      • setCascadeOnDelete

        public void setCascadeOnDelete​(java.lang.Boolean cascadeOnDelete)
        INTERNAL: Used for OX mapping.
      • setFetch

        public void setFetch​(java.lang.String fetch)
        INTERNAL: Used for OX mapping.
      • setForeignKey

        public void setForeignKey​(ForeignKeyMetadata foreignKey)
        INTERNAL: Used for OX mapping.
      • setJoinColumns

        public void setJoinColumns​(java.util.List<JoinColumnMetadata> joinColumns)
        INTERNAL: Used for OX mapping.
      • setJoinFields

        public void setJoinFields​(java.util.List<JoinFieldMetadata> joinFields)
        INTERNAL: Used for OX mapping.
      • setJoinFetch

        public void setJoinFetch​(java.lang.String joinFetch)
        INTERNAL: Used for OX mapping.
      • setJoinTable

        public void setJoinTable​(JoinTableMetadata joinTable)
        INTERNAL: Used for OX mapping.
      • setMappedBy

        public void setMappedBy​(java.lang.String mappedBy)
        INTERNAL: Used for OX mapping.
      • setNonCacheable

        public void setNonCacheable​(java.lang.Boolean noncacheable)
        INTERNAL: Used for OX mapping.
      • setOrphanRemoval

        public void setOrphanRemoval​(java.lang.Boolean orphanRemoval)
        INTERNAL: Used for OX mapping.
      • setPrivateOwned

        public void setPrivateOwned​(java.lang.Boolean privateOwned)
        INTERNAL: Used for OX mapping.
      • setTargetEntity

        public void setTargetEntity​(MetadataClass targetEntity)
        INTERNAL:
      • setTargetEntityName

        public void setTargetEntityName​(java.lang.String targetEntityName)
        INTERNAL: Used for OX mapping.