Record Class InsertConflictRenderingPlan.OnDuplicateKey

java.lang.Object
java.lang.Record
org.hibernate.dialect.sql.ast.spi.InsertConflictRenderingPlan.OnDuplicateKey
All Implemented Interfaces:
InsertConflictRenderingPlan
Enclosing interface:
InsertConflictRenderingPlan

public static record InsertConflictRenderingPlan.OnDuplicateKey(DoNothingSyntax doNothingSyntax, ValuesRowReferenceStyle valuesRowReferenceStyle) extends Record implements InsertConflictRenderingPlan

Render an on duplicate key update clause.

For InsertConflictAction.DO_UPDATE, the usual shape is:

insert into book (isbn, title) values (?, ?)
on duplicate key update title = values(title)

valuesRowReferenceStyle controls whether proposed values are expressed using values(title), an explicit excluded row alias, or the database's implicit excluded.title pseudo-row.

Because this syntax has no native do-nothing form on some databases, doNothingSyntax selects either a harmless self-assignment such as isbn=isbn, or a nothing keyword after on duplicate key update. Constraint names are not supported by this plan.

Since:
8.0
  • Constructor Details

    • OnDuplicateKey

      public OnDuplicateKey(DoNothingSyntax doNothingSyntax, ValuesRowReferenceStyle valuesRowReferenceStyle)
      Creates an instance of a OnDuplicateKey record class.
      Parameters:
      doNothingSyntax - the value for the doNothingSyntax record component
      valuesRowReferenceStyle - the value for the valuesRowReferenceStyle record component
  • Method Details

    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • doNothingSyntax

      public DoNothingSyntax doNothingSyntax()
      Returns the value of the doNothingSyntax record component.
      Returns:
      the value of the doNothingSyntax record component
    • valuesRowReferenceStyle

      public ValuesRowReferenceStyle valuesRowReferenceStyle()
      Returns the value of the valuesRowReferenceStyle record component.
      Returns:
      the value of the valuesRowReferenceStyle record component