Top Description Methods
org.hibernate.dialect.pagination

public Interface LimitHandler

Known Direct Implementers
org.hibernate.dialect.pagination.AbstractLimitHandler
Imports
java.sql.PreparedStatement, .SQLException, org.hibernate.engine.spi.QueryParameters, .RowSelection

Contract defining dialect-specific LIMIT clause handling. Typically implementers might consider extending AbstractLimitHandler class.
Author
Lukasz Antoniak (lukasz dot antoniak at gmail dot com)

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

The number of parameter values bound.
bindLimitParametersAtEndOfQuery
(RowSelection
the selection criteria for rows.
selection
,
PreparedStatement
Statement to which to bind limit parameter values.
statement
,
int
Index from which to start binding.
index
)

Bind parameter values needed by the LIMIT clause after original SELECT statement.

public int

Returns:

The number of parameter values bound.
bindLimitParametersAtStartOfQuery
(RowSelection
the selection criteria for rows.
selection
,
PreparedStatement
Statement to which to bind limit parameter values.
statement
,
int
Index from which to start binding.
index
)

Bind parameter values needed by the LIMIT clause before original SELECT statement.

public String

Returns:

Query statement with LIMIT clause applied.
processSql
(String
the SQL query to process.
sql
,
RowSelection
the selection criteria for rows.
selection
)

Return processed SQL query.

public default String

Returns:

Query statement with LIMIT clause applied.
processSql
(String
the SQL query to process.
sql
,
QueryParameters
the queryParameters.
queryParameters
)

Return processed SQL query.

public void
setMaxRows(RowSelection
the selection criteria for rows.
selection
,
PreparedStatement
Statement which number of returned rows shall be limited.
statement
)

Use JDBC API to limit the number of rows returned by the SQL query.

public boolean

Returns:

True if this handler supports some form of LIMIT.
supportsLimit
()

Does this handler support some form of limiting query results via a SQL clause?

public boolean

Returns:

True if the handler supports an offset within the limit support.
supportsLimitOffset
()

Does this handler's LIMIT support (if any) additionally support specifying an offset?

Method Detail

bindLimitParametersAtEndOfQueryback to summary
public int bindLimitParametersAtEndOfQuery(RowSelection selection, PreparedStatement statement, int index) throws SQLException

Bind parameter values needed by the LIMIT clause after original SELECT statement.

Parameters
selection:RowSelection

the selection criteria for rows.

statement:PreparedStatement

Statement to which to bind limit parameter values.

index:int

Index from which to start binding.

Returns:int

The number of parameter values bound.

Exceptions
SQLException:
Indicates problems binding parameter values.
bindLimitParametersAtStartOfQueryback to summary
public int bindLimitParametersAtStartOfQuery(RowSelection selection, PreparedStatement statement, int index) throws SQLException

Bind parameter values needed by the LIMIT clause before original SELECT statement.

Parameters
selection:RowSelection

the selection criteria for rows.

statement:PreparedStatement

Statement to which to bind limit parameter values.

index:int

Index from which to start binding.

Returns:int

The number of parameter values bound.

Exceptions
SQLException:
Indicates problems binding parameter values.
processSqlback to summary
public String processSql(String sql, RowSelection selection)

Return processed SQL query.

Parameters
sql:String

the SQL query to process.

selection:RowSelection

the selection criteria for rows.

Returns:String

Query statement with LIMIT clause applied.

processSqlback to summary
public default String processSql(String sql, QueryParameters queryParameters)

Return processed SQL query.

Parameters
sql:String

the SQL query to process.

queryParameters:QueryParameters

the queryParameters.

Returns:String

Query statement with LIMIT clause applied.

setMaxRowsback to summary
public void setMaxRows(RowSelection selection, PreparedStatement statement) throws SQLException

Use JDBC API to limit the number of rows returned by the SQL query. Typically handlers that do not support LIMIT clause should implement this method.

Parameters
selection:RowSelection

the selection criteria for rows.

statement:PreparedStatement

Statement which number of returned rows shall be limited.

Exceptions
SQLException:
Indicates problems while limiting maximum rows returned.
supportsLimitback to summary
public boolean supportsLimit()

Does this handler support some form of limiting query results via a SQL clause?

Returns:boolean

True if this handler supports some form of LIMIT.

supportsLimitOffsetback to summary
public boolean supportsLimitOffset()

Does this handler's LIMIT support (if any) additionally support specifying an offset?

Returns:boolean

True if the handler supports an offset within the limit support.