Record Class PaginationRequest
java.lang.Object
java.lang.Record
org.hibernate.dialect.pagination.spi.PaginationRequest
- Record Components:
sql- complete SQL before execution-time paginationfirstRow- zero-based first row, ornullwhen no offset was requestedmaxRows- maximum rows to return, ornullwhen no limit was requestedjdbcParameterCount- number of existing JDBC parameters, or-1when unknownparameterMarkerStrategy- native marker strategy, ornullfor?
@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 Summary
ConstructorsConstructorDescriptionPaginationRequest(String sql, Integer firstRow, Integer maxRows, int jdbcParameterCount, ParameterMarkerStrategy parameterMarkerStrategy) Creates an instance of aPaginationRequestrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.firstRow()Returns the value of thefirstRowrecord component.intThe requested zero-based first row, defaulting to zero.booleanWhether an explicit first-row option was supplied, including zero.final inthashCode()Returns a hash code value for this object.booleanWhether a positive maximum-row limit was supplied.booleanisEmpty()Whether neither an offset nor a positive limit needs to be applied.intReturns the value of thejdbcParameterCountrecord component.maxRows()Returns the value of themaxRowsrecord component.parameterMarker(int position) Create the marker for a one-based JDBC parameter position in the rewritten SQL.Returns the value of theparameterMarkerStrategyrecord component.sql()Returns the value of thesqlrecord component.final StringtoString()Returns a string representation of this record class.booleanWhether rewritten SQL must use ordinary?parameter markers.
-
Constructor Details
-
PaginationRequest
public PaginationRequest(String sql, @Nullable Integer firstRow, @Nullable Integer maxRows, int jdbcParameterCount, @Nullable ParameterMarkerStrategy parameterMarkerStrategy) Creates an instance of aPaginationRequestrecord class.- Parameters:
sql- the value for thesqlrecord componentfirstRow- the value for thefirstRowrecord componentmaxRows- the value for themaxRowsrecord componentjdbcParameterCount- the value for thejdbcParameterCountrecord componentparameterMarkerStrategy- the value for theparameterMarkerStrategyrecord component
-
-
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
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
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
sql
-
firstRow
-
maxRows
-
jdbcParameterCount
public int jdbcParameterCount()Returns the value of thejdbcParameterCountrecord component.- Returns:
- the value of the
jdbcParameterCountrecord component
-
parameterMarkerStrategy
Returns the value of theparameterMarkerStrategyrecord component.- Returns:
- the value of the
parameterMarkerStrategyrecord component
-