Record Class StatementShapeKey

java.lang.Object
java.lang.Record
org.hibernate.action.queue.spi.StatementShapeKey
All Implemented Interfaces:
org.hibernate.action.queue.internal.support.OperationGroupKey, BatchKey

@Incubating public record StatementShapeKey(String tableExpression, MutationKind kind, int shapeHash) extends Record implements BatchKey, org.hibernate.action.queue.internal.support.OperationGroupKey

Helps identify similar mutations more concretely that just type+table. This takes into consideration shapeHash as well, which might be based on columns included / not included, etc.

Useful as a key for batching.

Since:
8.0
  • Constructor Details

    • StatementShapeKey

      public StatementShapeKey(String tableExpression, MutationKind kind, int shapeHash)
      Creates an instance of a StatementShapeKey record class.
      Parameters:
      tableExpression - the value for the tableExpression record component
      kind - the value for the kind record component
      shapeHash - the value for the shapeHash record component
  • Method Details

    • forInsert

      public static StatementShapeKey forInsert(String tableName, FlushOperation flushOperation)
    • forUpdate

      public static StatementShapeKey forUpdate(String tableName, FlushOperation flushOperation)
    • forUpdateOrder

      public static StatementShapeKey forUpdateOrder(String tableName, FlushOperation flushOperation)
    • forDelete

      public static StatementShapeKey forDelete(String tableName, FlushOperation flushOperation)
    • forNoOp

      public static StatementShapeKey forNoOp(String tableName)
    • forMutation

      public static StatementShapeKey forMutation(String tableName, MutationKind kind, TableDescriptor tableDescriptor, MutationOperation mutationOperation)
    • 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.
    • tableExpression

      public String tableExpression()
      Returns the value of the tableExpression record component.
      Returns:
      the value of the tableExpression record component
    • kind

      public MutationKind kind()
      Returns the value of the kind record component.
      Returns:
      the value of the kind record component
    • shapeHash

      public int shapeHash()
      Returns the value of the shapeHash record component.
      Returns:
      the value of the shapeHash record component