Annotation Type ManyToOne


@Retention(CLASS) @Target(FIELD) public @interface ManyToOne
Maps a single related entity using a foreign key on the owning table.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Chooses operations to propagate to related entities.
    Controls relationship initialization.
    boolean
    Allows an owning to-one relationship to be null.
  • Element Details

    • fetch

      FetchType fetch
      Controls relationship initialization.
      Returns:
      fetch policy; EAGER for to-one and LAZY for collections by default
      Default:
      EAGER
    • cascade

      CascadeType[] cascade
      Chooses operations to propagate to related entities.
      Returns:
      cascade operations; empty by default
      Default:
      {}
    • optional

      boolean optional
      Allows an owning to-one relationship to be null.
      Returns:
      true by default; false makes the generated foreign key required
      Default:
      true