Annotation Type NotFound


  • @Target({METHOD,FIELD})
    @Retention(RUNTIME)
    public @interface NotFound
    Indicates that an association maps to a foreign key column without a foreign key constraint, and which thus potentially violates referential integrity.

    The action() specifies how Hibernate should handle 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 the association non-lazy.

    This annotation implies ConstraintMode.NO_CONSTRAINT for the purposes of DDL generation. That is, a foreign key constraint will not be included in the generated DDL.

    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      NotFoundAction action
      Specifies how to handle the case of an orphaned foreign key.
    • Element Detail

      • action

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

        By default, an exception is thrown.

        Default:
        org.hibernate.annotations.NotFoundAction.EXCEPTION