LimitHandler interface.
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected final int | Returns: The number of parameter values bound.the selection criteria for rows. selection, PreparedStatement Statement to which to bind limit parameter values. statement, int Index from which to start binding. index)Default implementation of binding parameter values needed by the LIMIT clause. |
| public int | 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)Implements org. |
| public int | 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)Implements org. |
| public boolean | Returns: true if limit parameters should come before other parametersDoes the LIMIT clause come at the start of the SELECT statement, rather than at the end? |
| public boolean | Returns: true if the correct order is limit, offsetANSI SQL defines the LIMIT clause to be in the form LIMIT offset, limit. |
| public int | Returns: The corresponding db/dialect specific offset.The user-supplied, zero-based first row offset. zeroBasedFirstResult)Hibernate APIs explicitly state that setFirstResult() should be a zero-based offset. |
| public boolean | Returns: True to force limit into SQL query even if none specified in Hibernate query; false otherwise.Generally, if there is no limit applied to a Hibernate query we do not apply any limits to the SQL query. |
| protected final int | Returns: The appropriate value to bind into the limit clause.the selection criteria for rows. selection)Some dialect-specific LIMIT clauses require the maximum last row number (aka, first_row_number + total_row_count), while others require the maximum returned row count (the total maximum number of rows to return). |
| public String | processSql(String
the SQL query to process. sql, RowSelection the selection criteria for rows. selection)Implements org. |
| public void | setMaxRows(RowSelection
the selection criteria for rows. selection, PreparedStatement Statement which number of returned rows shall be limited. statement)Implements org. |
| public boolean | supportsLimit()
Implements org. |
| public boolean | supportsLimitOffset()
Implements org. |
| public boolean | Returns: True if bind variables can be used; false otherwise.Does this handler support bind variables (i.e., prepared statement parameters) for its limit/offset? |
| public boolean | Returns: True if limit is relative from offset; false otherwise.Does the LIMIT clause take a "maximum" row number instead of a total number of returned rows? |
| AbstractLimitHandler | back to summary |
|---|---|
| protected AbstractLimitHandler() | |
| bindLimitParameters | back to summary |
|---|---|
| protected final int bindLimitParameters(RowSelection selection, PreparedStatement statement, int index) throws SQLException Default implementation of binding parameter values needed by the LIMIT clause.
| |
| bindLimitParametersAtEndOfQuery | back to summary |
|---|---|
| public int bindLimitParametersAtEndOfQuery(RowSelection selection, PreparedStatement statement, int index) throws SQLException Implements org. Doc from org. Bind parameter values needed by the LIMIT clause after original SELECT statement.
| |
| bindLimitParametersAtStartOfQuery | back to summary |
|---|---|
| public int bindLimitParametersAtStartOfQuery(RowSelection selection, PreparedStatement statement, int index) throws SQLException Implements org. Doc from org. Bind parameter values needed by the LIMIT clause before original SELECT statement.
| |
| bindLimitParametersFirst | back to summary |
|---|---|
| public boolean bindLimitParametersFirst() Does the LIMIT clause come at the start of the SELECT statement, rather than at the end?
| |
| bindLimitParametersInReverseOrder | back to summary |
|---|---|
| public boolean bindLimitParametersInReverseOrder() ANSI SQL defines the LIMIT clause to be in the form LIMIT offset, limit. Does this dialect require us to bind the parameters in reverse order?
| |
| convertToFirstRowValue | back to summary |
|---|---|
| public int convertToFirstRowValue(int zeroBasedFirstResult) Hibernate APIs explicitly state that setFirstResult() should be a zero-based offset. Here we allow the Dialect a chance to convert that value based on what the underlying db or driver will expect. Note what gets passed into
| |
| forceLimitUsage | back to summary |
|---|---|
| public boolean forceLimitUsage() Generally, if there is no limit applied to a Hibernate query we do not apply any limits to the SQL query. This option forces that the limit be written to the SQL query.
| |
| getMaxOrLimit | back to summary |
|---|---|
| protected final int getMaxOrLimit(RowSelection selection) Some dialect-specific LIMIT clauses require the maximum last row number (aka, first_row_number + total_row_count), while others require the maximum returned row count (the total maximum number of rows to return).
| |
| processSql | back to summary |
|---|---|
| public String processSql(String sql, RowSelection selection) Implements org. Doc from org. Return processed SQL query.
| |
| setMaxRows | back to summary |
|---|---|
| public void setMaxRows(RowSelection selection, PreparedStatement statement) throws SQLException Implements org. Doc from org. 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.
| |
| supportsLimit | back to summary |
|---|---|
| public boolean supportsLimit() Implements org. Doc from org. Does this handler support some form of limiting query results via a SQL clause?
| |
| supportsLimitOffset | back to summary |
|---|---|
| public boolean supportsLimitOffset() Implements org. Doc from org. Does this handler's LIMIT support (if any) additionally support specifying an offset?
| |
| supportsVariableLimit | back to summary |
|---|---|
| public boolean supportsVariableLimit() Does this handler support bind variables (i.e., prepared statement parameters) for its limit/offset?
| |
| useMaxForLimit | back to summary |
|---|---|
| public boolean useMaxForLimit() Does the LIMIT clause take a "maximum" row number instead of a total number of returned rows? This is easiest understood via an example. Consider you have a table with 20 rows, but you only want to retrieve rows number 11 through 20. Generally, a limit with offset would say that the offset = 11 and the limit = 10 (we only want 10 rows at a time); this is specifying the total number of returned rows. Some dialects require that we instead specify offset = 11 and limit = 20, where 20 is the "last" row we want relative to offset (i.e. total number of rows = 20 - 11 = 9) So essentially, is limit relative from offset? Or is limit absolute?
| |