Annotation Type ForeignKey


@Target({}) @Retention(RUNTIME) public @interface ForeignKey
The ForeignKey annotation is used in schema generation. It is used to define a foreign key constraint or to override or disable the persistence provider’s default foreign key definition.
Since:
JPA 2.1
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    (Optional) The foreign key constraint definition.
    (Optional) The name of the foreign key constraint.
    (Optional) Used to specify whether a foreign key constraint should be generated when schema generation is in effect.
  • Element Details

    • name

      String name
      (Optional) The name of the foreign key constraint. Defaults to a provider-generated name.
      Returns:
      The foreign key name
      Default:
      ""
    • foreignKeyDefinition

      String foreignKeyDefinition
      (Optional) The foreign key constraint definition. Default is provider defined. If the value of disableForeignKey is true, the provider must not generate a foreign key constraint.
      Returns:
      The foreign key definition
      Default:
      ""
    • value

      (Optional) Used to specify whether a foreign key constraint should be generated when schema generation is in effect.
      Returns:
      mode
      Default:
      CONSTRAINT