Enum NotFoundAction

  • All Implemented Interfaces:
    Serializable, Comparable<NotFoundAction>

    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:
    NotFound
    • Enum Constant Detail

      • 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 Detail

      • values

        public static NotFoundAction[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (NotFoundAction c : NotFoundAction.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static NotFoundAction valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified name
        NullPointerException - if the argument is null