Annotation Type ForeignKey

    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      java.lang.String foreignKeyDefinition
      (Optional) The foreign key constraint definition.
      java.lang.String name
      (Optional) The name of the foreign key constraint.
      java.lang.String options
      (Optional) A SQL fragment appended to the generated DDL which creates this foreign key.
      ConstraintMode value
      (Optional) Used to specify whether a foreign key constraint should be generated when schema generation is in effect.
    • Element Detail

      • name

        java.lang.String name
        (Optional) The name of the foreign key constraint.

        Defaults to a provider-generated name.

        Default:
        ""
      • value

        ConstraintMode value
        (Optional) Used to specify whether a foreign key constraint should be generated when schema generation is in effect.
        • ConstraintMode.CONSTRAINT specifies that the persistence provider must generate a foreign key constraint. If the foreignKeyDefinition() element is not specified, the provider will generate a constraint whose update and delete actions it determines most appropriate for the join column or columns to which the foreign key annotation is applied.
        • ConstraintMode.NO_CONSTRAINT specifies that no constraint should be generated.
        • ConstraintMode.PROVIDER_DEFAULT selects the default behavior of the provider, which may or may not result in generation of a constraint.
        Default:
        jakarta.persistence.ConstraintMode.CONSTRAINT
      • foreignKeyDefinition

        java.lang.String foreignKeyDefinition
        (Optional) The foreign key constraint definition.
        Default:
        ""
      • options

        java.lang.String options
        (Optional) A SQL fragment appended to the generated DDL which creates this foreign key. May not be used in conjunction with foreignKeyDefinition().
        Since:
        3.2
        Default:
        ""