Enum Class NotFoundAction

java.lang.Object
java.lang.Enum<NotFoundAction>
org.hibernate.annotations.NotFoundAction
All Implemented Interfaces:
Serializable, Comparable<NotFoundAction>, java.lang.constant.Constable

public enum NotFoundAction extends Enum<NotFoundAction>
Specifies how Hibernate should handle the case of an orphaned foreign key with no associated row in the referenced table. This is a situation that can only occur in a database with missing foreign key constraints.

When a database lacks foreign key constraints, it's normal for it to accumulate data with referential integrity violations over time. Alternatively, this situation is also sometimes encountered in legacy foreign key schemes where some "magic value", instead of NULL, indicates a missing reference.

See Also:
  • Enum Constant Details

    • EXCEPTION

      public static final NotFoundAction EXCEPTION
      Raise an exception when a foreign key value has no corresponding primary key value in the referenced table.
    • IGNORE

      public static final NotFoundAction IGNORE
      Treat a foreign key value with no corresponding primary key value in the referenced table as a null reference.
  • Method Details

    • values

      public static NotFoundAction[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static NotFoundAction valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null