Class Relationship

    • Field Detail

      • sourceEntity

        protected Entity sourceEntity
      • targetEntityName

        protected String targetEntityName
      • toMany

        protected boolean toMany
      • runtime

        protected boolean runtime
        A flag that specifies whether a Relationship was mapped by the user or added dynamically by Cayenne runtime.
        Since:
        3.0
    • Constructor Detail

      • Relationship

        public Relationship()
        Creates an unnamed relationship.
      • Relationship

        public Relationship​(String name)
        Creates a named relationship.
    • Method Detail

      • setName

        public void setName​(String name)
      • getSourceEntity

        public Entity getSourceEntity()
        Returns relationship source entity.
      • setSourceEntity

        public void setSourceEntity​(Entity sourceEntity)
        Sets relationship source entity.
      • getTargetEntity

        public abstract Entity getTargetEntity()
        Returns a target entity of the relationship.
      • setTargetEntityName

        public void setTargetEntityName​(Entity targetEntity)
        Sets relationship target entity. Internally calls setTargetEntityName.
      • getTargetEntityName

        public String getTargetEntityName()
        Returns the name of a target entity.
      • setTargetEntityName

        public void setTargetEntityName​(String targetEntityName)
        Sets the name of relationship target entity.
      • isToMany

        public boolean isToMany()
        Returns a boolean value that determines relationship multiplicity. This defines semantics of the connection between two nodes described by the source and target entities. E.g. to-many relationship between two Persistent object classes means that a source object would have a collection of target objects. This is a read-only property.
      • toString

        public String toString()
        Overrides Object.toString() to return informative description.
        Overrides:
        toString in class Object
      • isRuntime

        public boolean isRuntime()
        Since:
        3.0
      • setRuntime

        public void setRuntime​(boolean synthetic)
        Since:
        3.0
      • getReverseRelationship

        public abstract Relationship getReverseRelationship()
        Returns a "complimentary" relationship going in the opposite direction. Returns null if no such relationship is found.
        Since:
        3.1
      • isMandatory

        public abstract boolean isMandatory()
        Returns if relationship is mandatory
        Since:
        3.1