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.- Author:
- Guillaume Le Cousin
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description booleancascadeDeleteSpecifies if the foreign entity must be deleted when the owning entity is deleted or the foreign key is set to null.ForeignKey.OnForeignDeletedonForeignDeletedbooleanoptionalSpecifies 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
-
-