Record Class ForeignKeyConstraintRequest

java.lang.Object
java.lang.Record
org.hibernate.dialect.constraint.spi.ForeignKeyConstraintRequest

@SPI(USE) public record ForeignKeyConstraintRequest(String constraintName, List<String> sourceColumnNames, @Nullable String referencedTableName, List<String> targetColumnNames, boolean referencesPrimaryKey, @Nullable String explicitDefinition) extends Record

Describes one foreign-key constraint to be added to an existing table.

Use structured(String, List, String, List, boolean) for mapping-model foreign keys and explicit(String, String) for an explicitly supplied SQL definition. Rendered identifiers and SQL fragments are consumed verbatim.

Since:
8.0
  • Constructor Details

    • ForeignKeyConstraintRequest

      public ForeignKeyConstraintRequest(String constraintName, List<String> sourceColumnNames, @Nullable String referencedTableName, List<String> targetColumnNames, boolean referencesPrimaryKey, @Nullable String explicitDefinition)
      Creates an instance of a ForeignKeyConstraintRequest record class.
      Parameters:
      constraintName - the value for the constraintName record component
      sourceColumnNames - the value for the sourceColumnNames record component
      referencedTableName - the value for the referencedTableName record component
      targetColumnNames - the value for the targetColumnNames record component
      referencesPrimaryKey - the value for the referencesPrimaryKey record component
      explicitDefinition - the value for the explicitDefinition record component
  • Method Details

    • structured

      public static ForeignKeyConstraintRequest structured(String constraintName, List<String> sourceColumnNames, String referencedTableName, List<String> targetColumnNames, boolean referencesPrimaryKey)
    • explicit

      public static ForeignKeyConstraintRequest explicit(String constraintName, String explicitDefinition)
    • isExplicitDefinition

      public boolean isExplicitDefinition()
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • constraintName

      public String constraintName()
      Returns the value of the constraintName record component.
      Returns:
      the value of the constraintName record component
    • sourceColumnNames

      public List<String> sourceColumnNames()
      Returns the value of the sourceColumnNames record component.
      Returns:
      the value of the sourceColumnNames record component
    • referencedTableName

      @Nullable public String referencedTableName()
      Returns the value of the referencedTableName record component.
      Returns:
      the value of the referencedTableName record component
    • targetColumnNames

      public List<String> targetColumnNames()
      Returns the value of the targetColumnNames record component.
      Returns:
      the value of the targetColumnNames record component
    • referencesPrimaryKey

      public boolean referencesPrimaryKey()
      Returns the value of the referencesPrimaryKey record component.
      Returns:
      the value of the referencesPrimaryKey record component
    • explicitDefinition

      @Nullable public String explicitDefinition()
      Returns the value of the explicitDefinition record component.
      Returns:
      the value of the explicitDefinition record component