Top Description Methods
org.hibernate

public Interface ScrollableResults<R>

extends AutoCloseable, Closeable
Known Direct Subinterfaces
org.hibernate.query.spi.ScrollableResultsImplementor
Imports
java.io.Closeable, org.hibernate.query.Query

A result iterator that allows moving around within the results by arbitrary increments. The Query / ScrollableResults pattern is very similar to the JDBC java.sql.PreparedStatement/ java.sql.ResultSet pattern and so the semantics of methods of this interface are similar to the similarly-named methods of ResultSet.

Contrary to JDBC, columns of results are numbered from zero.

Author
Gavin King
See Also
Query#scroll()

Method Summary

Modifier and TypeMethod and Description
public void
afterLast()

Go to a location just after the last result.

public void
beforeFirst()

Go to a location just before first result.

public void
close()

Redeclares java.lang.AutoCloseable.close, java.io.Closeable.close.

Release resources immediately.
public boolean

Returns:

true if there are any results
first
()

Go to the first result.

public R

Returns:

The array of results
get
()

Get the current row of results.

public int

Returns:

The current position number, numbered from 0; -1 indicates that there is no current row
getRowNumber
()

Get the current position in the results.

public boolean

Returns:

true if this is the first row of results, otherwise false
isFirst
()

Is this the first result?

public boolean

Returns:

true if this is the last row of results.
isLast
()

Is this the last result?

public boolean

Returns:

true if there are any results
last
()

Go to the last result.

public boolean

Returns:

true if there is another result
next
()

Advance to the next result.

public boolean

Returns:

true if there is a result at the new location
position
(int position)

Moves the result cursor to the specified position.

public boolean

Returns:

true if there is a previous result
previous
()

Retreat to the previous result.

public boolean

Returns:

true if there is a result at the new location
scroll
(int
a positive (forward) or negative (backward) number of rows
positions
)

Scroll the specified number of positions from the current position.

public void
setFetchSize(int fetchSize)

Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed.

public boolean

Returns:

true if there is a row at that row number
setRowNumber
(int
the row number. A positive number indicates a value numbered from the first row; a negative number indicates a value numbered from the last row.
rowNumber
)

Set the current position in the result set.

Method Detail

afterLastback to summary
public void afterLast()

Go to a location just after the last result.

beforeFirstback to summary
public void beforeFirst()

Go to a location just before first result.

This is the location of the cursor on a newly returned scrollable result.

closeback to summary
public void close()

Redeclares java.lang.AutoCloseable.close, java.io.Closeable.close.

Release resources immediately.

firstback to summary
public boolean first()

Go to the first result.

Returns:boolean

true if there are any results

getback to summary
public R get()

Get the current row of results.

Returns:R

The array of results

getRowNumberback to summary
public int getRowNumber()

Get the current position in the results.

The first position is number 0 (unlike JDBC).

Returns:int

The current position number, numbered from 0; -1 indicates that there is no current row

isFirstback to summary
public boolean isFirst()

Is this the first result?

Returns:boolean

true if this is the first row of results, otherwise false

isLastback to summary
public boolean isLast()

Is this the last result?

Returns:boolean

true if this is the last row of results.

lastback to summary
public boolean last()

Go to the last result.

Returns:boolean

true if there are any results

nextback to summary
public boolean next()

Advance to the next result.

Returns:boolean

true if there is another result

positionback to summary
public boolean position(int position)

Moves the result cursor to the specified position.

Returns:boolean

true if there is a result at the new location

previousback to summary
public boolean previous()

Retreat to the previous result.

Returns:boolean

true if there is a previous result

scrollback to summary
public boolean scroll(int positions)

Scroll the specified number of positions from the current position.

Parameters
positions:int

a positive (forward) or negative (backward) number of rows

Returns:boolean

true if there is a result at the new location

setFetchSizeback to summary
public void setFetchSize(int fetchSize)

Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed. If 0, the JDBC driver's default setting will be used.

Since
6.1.2
See Also
java.sql.ResultSet#setFetchSize(int), org.hibernate.cfg.AvailableSettings#STATEMENT_FETCH_SIZE
setRowNumberback to summary
public boolean setRowNumber(int rowNumber)

Set the current position in the result set.

Can be numbered from the first result (positive number) or backward from the last result (negative number).

Parameters
rowNumber:int

the row number. A positive number indicates a value numbered from the first row; a negative number indicates a value numbered from the last row.

Returns:boolean

true if there is a row at that row number