Annotation Interface Relationship


@Retention(RUNTIME) @Target(FIELD) @Documented @Inherited @API(status=STABLE, since="6.0") public @interface Relationship
Annotation to configure mappings of relationship.
Since:
6.0
Author:
Michael J. Simons
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Enumeration of the direction a relationship can take.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Set this attribute to false if you don't want updates on an aggregate root to be cascaded to related objects.
    If direction is Relationship.Direction.OUTGOING, than the attribute annotated with Relationship will be the target node of the relationship and the class containing the annotated attribute will be the start node.
     
     
  • Element Details

    • value

      @AliasFor("type") String value
      Returns:
      See type().
      Default:
      ""
    • type

      @AliasFor("value") String type
      Returns:
      The type of the relationship.
      Default:
      ""
    • direction

      If direction is Relationship.Direction.OUTGOING, than the attribute annotated with Relationship will be the target node of the relationship and the class containing the annotated attribute will be the start node.

      If direction is Relationship.Direction.INCOMING, than the attribute annotated with Relationship will be the start node of the relationship and the class containing the annotated attribute will be the end node.

      Returns:
      The direction of the relationship.
      Default:
      OUTGOING
    • cascadeUpdates

      boolean cascadeUpdates
      Set this attribute to false if you don't want updates on an aggregate root to be cascaded to related objects. Be aware that in this case you are responsible to manually save the related objects and that you might end up with a local object graph that is not in sync with the actual graph.
      Returns:
      whether updates to the owning instance should be cascaded to the related objects
      Default:
      true