Top Description Methods
org.hibernate

public Interface ScrollableResults

extends AutoCloseable, Closeable
Known Direct Subinterfaces
org.hibernate.query.spi.ScrollableResultsImplementor
Known Direct Implementers
org.hibernate.internal.ScrollableResultsImpl
Imports
java.io.Closeable, java.math.BigDecimal, .BigInteger, java.sql.Blob, .Clob, java.util.Calendar, .Date, .Locale, .TimeZone, org.hibernate.type.Type

A result iterator that allows moving around within the results by arbitrary increments. The Query / ScrollableResults pattern is very similar to the JDBC PreparedStatement/ ResultSet pattern and the semantics of methods of this interface are similar to the similarly named methods on 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, This is the location of the cursor on a newly returned scrollable 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 Object[]

Returns:

The array of results
get
()

Get the current row of results.

public Object

Returns:

The requested result object; may return null
get
(int
the column, numbered from zero
i
)

Get the ith object in the current row of results, without initializing any other results in the row.

public BigDecimal

Returns:

The column value as a BigDecimal
getBigDecimal
(int
The column, numbered from zero
col
)

Convenience method to read a BigDecimal.

public BigInteger

Returns:

The column value as a BigInteger
getBigInteger
(int
The column, numbered from zero
col
)

Convenience method to read a BigInteger.

public byte[]

Returns:

The column value as a binary (byte[])
getBinary
(int
The column, numbered from zero
col
)

Convenience method to read a binary (byte[]).

public Blob

Returns:

The column value as a Blob
getBlob
(int
The column, numbered from zero
col
)

Convenience method to read a blob.

public Boolean

Returns:

The column value as a boolean
getBoolean
(int
The column, numbered from zero
col
)

Convenience method to read a boolean.

public Byte

Returns:

The column value as a byte
getByte
(int
The column, numbered from zero
col
)

Convenience method to read a byte.

public Calendar

Returns:

The column value as a Calendar
getCalendar
(int
The column, numbered from zero
col
)

Convenience method to read a Calendar.

public Character

Returns:

The column value as a char
getCharacter
(int
The column, numbered from zero
col
)

Convenience method to read a char.

public Clob

Returns:

The column value as a Clob
getClob
(int
The column, numbered from zero
col
)

Convenience method to read a clob.

public Date

Returns:

The column value as a Date
getDate
(int
The column, numbered from zero
col
)

Convenience method to read a Date.

public Double

Returns:

The column value as a double
getDouble
(int
The column, numbered from zero
col
)

Convenience method to read a double.

public Float

Returns:

The column value as a float
getFloat
(int
The column, numbered from zero
col
)

Convenience method to read a float.

public Integer

Returns:

The column value as an integer
getInteger
(int
The column, numbered from zero
col
)

Convenience method to read an integer.

public Locale

Returns:

The column value as a Locale
getLocale
(int
The column, numbered from zero
col
)

Convenience method to read a Locale.

public Long

Returns:

The column value as a long
getLong
(int
The column, numbered from zero
col
)

Convenience method to read a long.

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 Short

Returns:

The column value as a short
getShort
(int
The column, numbered from zero
col
)

Convenience method to read a short.

public String

Returns:

The column value as a String
getString
(int
The column, numbered from zero
col
)

Convenience method to read a string.

public String

Returns:

The column value as a String
getText
(int
The column, numbered from zero
col
)

Convenience method to read a String using streaming.

public TimeZone

Returns:

The column value as a TimeZone
getTimeZone
(int
The column, numbered from zero
col
)

Convenience method to read a TimeZone.

public Type

Returns:

the Hibernate type
getType
(int
the column, numbered from zero
i
)

Get the type of the ith column of 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 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 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 Object[] get()

Get the current row of results.

Returns:Object[]

The array of results

getback to summary
public Object get(int i)

Get the ith object in the current row of results, without initializing any other results in the row. This method may be used safely, regardless of the type of the column (ie. even for scalar results).

Parameters
i:int

the column, numbered from zero

Returns:Object

The requested result object; may return null

Exceptions
IndexOutOfBoundsException:
If i is an invalid index.
getBigDecimalback to summary
public BigDecimal getBigDecimal(int col)

Convenience method to read a BigDecimal.

Parameters
col:int

The column, numbered from zero

Returns:BigDecimal

The column value as a BigDecimal

Exceptions
IndexOutOfBoundsException:
If col is an invalid index.
getBigIntegerback to summary
public BigInteger getBigInteger(int col)

Convenience method to read a BigInteger.

Parameters
col:int

The column, numbered from zero

Returns:BigInteger

The column value as a BigInteger

Exceptions
IndexOutOfBoundsException:
If col is an invalid index.
getBinaryback to summary
public byte[] getBinary(int col)

Convenience method to read a binary (byte[]).

Parameters
col:int

The column, numbered from zero

Returns:byte[]

The column value as a binary (byte[])

Exceptions
IndexOutOfBoundsException:
If col is an invalid index.
getBlobback to summary
public Blob getBlob(int col)

Convenience method to read a blob.

Parameters
col:int

The column, numbered from zero

Returns:Blob

The column value as a Blob

Exceptions
IndexOutOfBoundsException:
If col is an invalid index.
getBooleanback to summary
public Boolean getBoolean(int col)

Convenience method to read a boolean.

Parameters
col:int

The column, numbered from zero

Returns:Boolean

The column value as a boolean

Exceptions
IndexOutOfBoundsException:
If col is an invalid index.
getByteback to summary
public Byte getByte(int col)

Convenience method to read a byte.

Parameters
col:int

The column, numbered from zero

Returns:Byte

The column value as a byte

Exceptions
IndexOutOfBoundsException:
If col is an invalid index.
getCalendarback to summary
public Calendar getCalendar(int col)

Convenience method to read a Calendar.

Parameters
col:int

The column, numbered from zero

Returns:Calendar

The column value as a Calendar

Exceptions
IndexOutOfBoundsException:
If col is an invalid index.
getCharacterback to summary
public Character getCharacter(int col)

Convenience method to read a char.

Parameters
col:int

The column, numbered from zero

Returns:Character

The column value as a char

Exceptions
IndexOutOfBoundsException:
If col is an invalid index.
getClobback to summary
public Clob getClob(int col)

Convenience method to read a clob.

Parameters
col:int

The column, numbered from zero

Returns:Clob

The column value as a Clob

Exceptions
IndexOutOfBoundsException:
If col is an invalid index.
getDateback to summary
public Date getDate(int col)

Convenience method to read a Date.

Parameters
col:int

The column, numbered from zero

Returns:Date

The column value as a Date

Exceptions
IndexOutOfBoundsException:
If col is an invalid index.
getDoubleback to summary
public Double getDouble(int col)

Convenience method to read a double.

Parameters
col:int

The column, numbered from zero

Returns:Double

The column value as a double

Exceptions
IndexOutOfBoundsException:
If col is an invalid index.
getFloatback to summary
public Float getFloat(int col)

Convenience method to read a float.

Parameters
col:int

The column, numbered from zero

Returns:Float

The column value as a float

Exceptions
IndexOutOfBoundsException:
If col is an invalid index.
getIntegerback to summary
public Integer getInteger(int col)

Convenience method to read an integer.

Parameters
col:int

The column, numbered from zero

Returns:Integer

The column value as an integer

Exceptions
IndexOutOfBoundsException:
If col is an invalid index.
getLocaleback to summary
public Locale getLocale(int col)

Convenience method to read a Locale.

Parameters
col:int

The column, numbered from zero

Returns:Locale

The column value as a Locale

Exceptions
IndexOutOfBoundsException:
If col is an invalid index.
getLongback to summary
public Long getLong(int col)

Convenience method to read a long.

Parameters
col:int

The column, numbered from zero

Returns:Long

The column value as a long

Exceptions
IndexOutOfBoundsException:
If col is an invalid index.
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

getShortback to summary
public Short getShort(int col)

Convenience method to read a short.

Parameters
col:int

The column, numbered from zero

Returns:Short

The column value as a short

Exceptions
IndexOutOfBoundsException:
If col is an invalid index.
getStringback to summary
public String getString(int col)

Convenience method to read a string.

Parameters
col:int

The column, numbered from zero

Returns:String

The column value as a String

Exceptions
IndexOutOfBoundsException:
If col is an invalid index.
getTextback to summary
public String getText(int col)

Convenience method to read a String using streaming.

Parameters
col:int

The column, numbered from zero

Returns:String

The column value as a String

Exceptions
IndexOutOfBoundsException:
If col is an invalid index.
getTimeZoneback to summary
public TimeZone getTimeZone(int col)

Convenience method to read a TimeZone.

Parameters
col:int

The column, numbered from zero

Returns:TimeZone

The column value as a TimeZone

Exceptions
IndexOutOfBoundsException:
If col is an invalid index.
getTypeback to summary
public Type getType(int i)

Get the type of the ith column of results.

Parameters
i:int

the column, numbered from zero

Returns:Type

the Hibernate type

Exceptions
IndexOutOfBoundsException:
If i is an invalid index.
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

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

setRowNumberback to summary
public boolean setRowNumber(int rowNumber)

Set the current position in the result set. Can be numbered from the first position (positive number) or the last row (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