Top Description Methods
org.hibernate.annotations

public @Interface NotFound

extends Annotation
Annotations
@Target:METHOD, FIELD
@Retention:RUNTIME
Imports
java.lang.annotation.Retention, .Target

Indicates that a many to one, one to one, or many to many association maps to a column holding foreign keys, but without a foreign key constraint, and which may therefore violate referential integrity.

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:

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.persistence.ConstraintMode#NO_CONSTRAINT for the purposes of DDL generation. That is, no foreign key constraint will be included in the generated DDL.

Author
Emmanuel Bernard

Method Summary

Modifier and TypeMethod and Description
public NotFoundAction
action()

Specifies how to handle the case of an orphaned foreign key.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

actionback to summary
public NotFoundAction action()

Specifies how to handle the case of an orphaned foreign key.

By default, an exception is thrown.