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

      • getBatchFetch

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

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

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

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

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

        public 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 String getLoggingContext()
        INTERNAL: Return the logging context for this accessor.
      • getMappedBy

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

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

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

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

        public 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 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​(ForeignReferenceMapping mapping)
        INTERNAL: Set the batch fetch type on the foreign reference mapping.
      • processOrphanRemoval

        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.)
      • processRelationshipMapping

        protected void processRelationshipMapping​(ForeignReferenceMapping mapping)
        INTERNAL: Process settings common to ForeignReferenceMapping.
      • 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​(Boolean cascadeOnDelete)
        INTERNAL: Used for OX mapping.
      • setFetch

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

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

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

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

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

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

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

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

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

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

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

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