Package org.hibernate.dialect.pagination
Interface LimitHandler
-
- All Known Implementing Classes:
AbstractLimitHandler
,CUBRIDLimitHandler
,FirstLimitHandler
,Informix10LimitHandler
,LegacyFirstLimitHandler
,LegacyLimitHandler
,NoopLimitHandler
,Oracle12LimitHandler
,SQL2008StandardLimitHandler
,SQLServer2005LimitHandler
,SQLServer2012LimitHandler
,SybaseASE157LimitHandler
,TopLimitHandler
public interface LimitHandler
Contract defining dialect-specific LIMIT clause handling. Typically implementers might consider extendingAbstractLimitHandler
class.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description int
bindLimitParametersAtEndOfQuery(RowSelection selection, java.sql.PreparedStatement statement, int index)
Bind parameter values needed by the LIMIT clause after original SELECT statement.int
bindLimitParametersAtStartOfQuery(RowSelection selection, java.sql.PreparedStatement statement, int index)
Bind parameter values needed by the LIMIT clause before original SELECT statement.default java.lang.String
processSql(java.lang.String sql, QueryParameters queryParameters)
Return processed SQL query.java.lang.String
processSql(java.lang.String sql, RowSelection selection)
Return processed SQL query.void
setMaxRows(RowSelection selection, java.sql.PreparedStatement statement)
Use JDBC API to limit the number of rows returned by the SQL query.boolean
supportsLimit()
Does this handler support some form of limiting query results via a SQL clause?boolean
supportsLimitOffset()
Does this handler's LIMIT support (if any) additionally support specifying an offset?
-
-
-
Method Detail
-
supportsLimit
boolean supportsLimit()
Does this handler support some form of limiting query results via a SQL clause?- Returns:
- True if this handler supports some form of LIMIT.
-
supportsLimitOffset
boolean supportsLimitOffset()
Does this handler's LIMIT support (if any) additionally support specifying an offset?- Returns:
- True if the handler supports an offset within the limit support.
-
processSql
java.lang.String processSql(java.lang.String sql, RowSelection selection)
Return processed SQL query.- Parameters:
sql
- the SQL query to process.selection
- the selection criteria for rows.- Returns:
- Query statement with LIMIT clause applied.
-
processSql
default java.lang.String processSql(java.lang.String sql, QueryParameters queryParameters)
Return processed SQL query.- Parameters:
sql
- the SQL query to process.queryParameters
- the queryParameters.- Returns:
- Query statement with LIMIT clause applied.
-
bindLimitParametersAtStartOfQuery
int bindLimitParametersAtStartOfQuery(RowSelection selection, java.sql.PreparedStatement statement, int index) throws java.sql.SQLException
Bind parameter values needed by the LIMIT clause before original SELECT statement.- Parameters:
selection
- the selection criteria for rows.statement
- Statement to which to bind limit parameter values.index
- Index from which to start binding.- Returns:
- The number of parameter values bound.
- Throws:
java.sql.SQLException
- Indicates problems binding parameter values.
-
bindLimitParametersAtEndOfQuery
int bindLimitParametersAtEndOfQuery(RowSelection selection, java.sql.PreparedStatement statement, int index) throws java.sql.SQLException
Bind parameter values needed by the LIMIT clause after original SELECT statement.- Parameters:
selection
- the selection criteria for rows.statement
- Statement to which to bind limit parameter values.index
- Index from which to start binding.- Returns:
- The number of parameter values bound.
- Throws:
java.sql.SQLException
- Indicates problems binding parameter values.
-
setMaxRows
void setMaxRows(RowSelection selection, java.sql.PreparedStatement statement) throws java.sql.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
- the selection criteria for rows.statement
- Statement which number of returned rows shall be limited.- Throws:
java.sql.SQLException
- Indicates problems while limiting maximum rows returned.
-
-