Annotation Type OneToOne
Maps a single related entity with a unique owning foreign key, or an inverse mappedBy field.
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionChooses operations to propagate to related entities.Controls relationship initialization.Names the owning Java relationship field on the target entity.booleanAllows an owning to-one relationship to be null.booleanDeletes a related entity removed from this one-to-one or one-to-many association at flush.
-
Element Details
-
fetch
FetchType fetchControls relationship initialization.- Returns:
- fetch policy; EAGER for to-one and LAZY for collections by default
- Default:
EAGER
-
cascade
CascadeType[] cascadeChooses operations to propagate to related entities.- Returns:
- cascade operations; empty by default
- Default:
{}
-
mappedBy
String mappedByNames the owning Java relationship field on the target entity.- Returns:
- owning field name, or empty for the owning side
- Default:
""
-
orphanRemoval
boolean orphanRemovalDeletes a related entity removed from this one-to-one or one-to-many association at flush.- Returns:
- true to delete orphans; false by default
- Default:
false
-
optional
boolean optionalAllows an owning to-one relationship to be null.- Returns:
- true by default; false makes the generated foreign key required
- Default:
true
-