Annotation Type ForeignKey


  • @Retention(RUNTIME)
    @Target(FIELD)
    @Column
    public @interface ForeignKey
    Indicates that a field is a foreign key to another table. It is automatically configured as a column, and cannot be used on a collection attribute.
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      boolean cascadeDelete
      Specifies if the foreign entity must be deleted when the owning entity is deleted or the foreign key is set to null.
      ForeignKey.OnForeignDeleted onForeignDeleted  
      boolean optional
      Specifies if the link is optional or not.
    • Element Detail

      • optional

        boolean optional
        Specifies if the link is optional or not. In other words, an optional foreign key is nullable.
        This is almost the same as onForeignDeleted, but we may want an optional link to be deleted on forein deleted, for example in a tree, the root is nullable, but if a parent is deleted we want the children to be deleted.
        Default:
        false
      • onForeignDeleted

        ForeignKey.OnForeignDeleted onForeignDeleted
        Default:
        net.lecousin.reactive.data.relational.annotations.ForeignKey.OnForeignDeleted.DELETE
      • cascadeDelete

        boolean cascadeDelete
        Specifies if the foreign entity must be deleted when the owning entity is deleted or the foreign key is set to null.
        Default:
        false