Record Class PaginationRequest

java.lang.Object
java.lang.Record
org.hibernate.dialect.pagination.spi.PaginationRequest
Record Components:
sql - complete SQL before execution-time pagination
firstRow - zero-based first row, or null when no offset was requested
maxRows - maximum rows to return, or null when no limit was requested
jdbcParameterCount - number of existing JDBC parameters, or -1 when unknown
parameterMarkerStrategy - native marker strategy, or null for ?

@SPI public record PaginationRequest(String sql, @Nullable Integer firstRow, @Nullable Integer maxRows, int jdbcParameterCount, @Nullable ParameterMarkerStrategy parameterMarkerStrategy) extends Record

Immutable input supplied by Hibernate to a LimitHandler for applying execution-time pagination to completed SQL.

A handler may rewrite sql and introduce JDBC parameters, but must not retain this request. null first-row and maximum-row values mean that the corresponding option was not specified. A jdbcParameterCount of -1 means that Hibernate could not determine the existing parameter count; a handler which needs numbered markers after existing parameters must account for that limitation.

Since:
8.0
  • Constructor Details

  • Method Details

    • hasFirstRow

      public boolean hasFirstRow()
      Whether an explicit first-row option was supplied, including zero.
    • hasMaxRows

      public boolean hasMaxRows()
      Whether a positive maximum-row limit was supplied.
    • isEmpty

      public boolean isEmpty()
      Whether neither an offset nor a positive limit needs to be applied.
    • firstRowOrZero

      public int firstRowOrZero()
      The requested zero-based first row, defaulting to zero.
    • parameterMarker

      public String parameterMarker(int position)
      Create the marker for a one-based JDBC parameter position in the rewritten SQL.
    • usesStandardParameterMarkers

      public boolean usesStandardParameterMarkers()
      Whether rewritten SQL must use ordinary ? parameter markers.
    • 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.
    • sql

      public String sql()
      Returns the value of the sql record component.
      Returns:
      the value of the sql record component
    • firstRow

      @Nullable public Integer firstRow()
      Returns the value of the firstRow record component.
      Returns:
      the value of the firstRow record component
    • maxRows

      @Nullable public Integer maxRows()
      Returns the value of the maxRows record component.
      Returns:
      the value of the maxRows record component
    • jdbcParameterCount

      public int jdbcParameterCount()
      Returns the value of the jdbcParameterCount record component.
      Returns:
      the value of the jdbcParameterCount record component
    • parameterMarkerStrategy

      @Nullable public ParameterMarkerStrategy parameterMarkerStrategy()
      Returns the value of the parameterMarkerStrategy record component.
      Returns:
      the value of the parameterMarkerStrategy record component