The action specifies how Hibernate should handle violations of
referential integrity, that is, the case of an orphaned foreign key with
no associated row in the referenced table:
NotFoundAction#EXCEPTION specifies that this situation
should be treated as an error, causing a
org.hibernate.exception.ConstraintViolationException , and
NotFoundAction#IGNORE specifies that this situation should
be tolerated and treated as if the foreign key were null.
Note that this annotation has the side effect of making a to-one association non-lazy. It does not affect the laziness of a many-to-many association.
This annotation implies
jakarta. for the purposes
of DDL generation. That is, no foreign key constraint will be included
in the generated DDL.
| Modifier and Type | Method and Description |
|---|---|
| public NotFoundAction |
| action | back to summary |
|---|---|
| public NotFoundAction action() Specifies how to handle the case of an orphaned foreign key. By default, an exception is thrown. | |