Top Description Methods
org.hibernate

public Interface ScrollableResults

Known Direct Implementers
org.hibernate.impl.AbstractScrollableResults, org.hibernate.impl.ScrollableResultsImpl
Imports
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 initial location)

public void
close()

Release resources immediately.

public boolean

Returns:

true if there are any results
first
()

Go to the first result

public Object[]

Returns:

an object or array
get
()

Get the current row of results

public Object

Returns:

an object of any Hibernate type or 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
getBigDecimal(int col)

Convenience method to read a big_decimal

public BigInteger
getBigInteger(int col)

Convenience method to read a big_integer

public byte[]
getBinary(int col)

Convenience method to read a binary

public Blob
getBlob(int col)

Convenience method to read a blob

public Boolean
getBoolean(int col)

Convenience method to read a boolean

public Byte
getByte(int col)

Convenience method to read a byte

public Calendar
getCalendar(int col)

Convenience method to read a calendar or calendar_date

public Character
getCharacter(int col)

Convenience method to read a character

public Clob
getClob(int col)

Convenience method to read a clob

public Date
getDate(int col)

Convenience method to read a date, time or timestamp

public Double
getDouble(int col)

Convenience method to read a double

public Float
getFloat(int col)

Convenience method to read a float

public Integer
getInteger(int col)

Convenience method to read an integer

public Locale
getLocale(int col)

Convenience method to read a locale

public Long
getLong(int col)

Convenience method to read a long

public int

Returns:

the row number, numbered from 0, or -1 if there is no current row
getRowNumber
()

Get the current location in the result set.

public Short
getShort(int col)

Convenience method to read a short

public String
getString(int col)

Convenience method to read a string

public String
getText(int col)

Convenience method to read text

public TimeZone
getTimeZone(int 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
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
i
)

Scroll an arbitrary number of locations

public boolean

Returns:

true if there is a row at that row number
setRowNumber
(int
the row number, numbered from the last row, in the case of a negative row number
rowNumber
)

Set the current location in the result set, numbered from either the first row (row number 0), or the last row (row number -1).

Method Detail

afterLastback to summary
public void afterLast() throws HibernateException

Go to a location just after the last result

beforeFirstback to summary
public void beforeFirst() throws HibernateException

Go to a location just before first result (this is the initial location)

closeback to summary
public void close() throws HibernateException

Release resources immediately.

firstback to summary
public boolean first() throws HibernateException

Go to the first result

Returns:boolean

true if there are any results

getback to summary
public Object[] get() throws HibernateException

Get the current row of results

Returns:Object[]

an object or array

getback to summary
public Object get(int i) throws HibernateException

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

an object of any Hibernate type or null

getBigDecimalback to summary
public BigDecimal getBigDecimal(int col) throws HibernateException

Convenience method to read a big_decimal

getBigIntegerback to summary
public BigInteger getBigInteger(int col) throws HibernateException

Convenience method to read a big_integer

getBinaryback to summary
public byte[] getBinary(int col) throws HibernateException

Convenience method to read a binary

getBlobback to summary
public Blob getBlob(int col) throws HibernateException

Convenience method to read a blob

getBooleanback to summary
public Boolean getBoolean(int col) throws HibernateException

Convenience method to read a boolean

getByteback to summary
public Byte getByte(int col) throws HibernateException

Convenience method to read a byte

getCalendarback to summary
public Calendar getCalendar(int col) throws HibernateException

Convenience method to read a calendar or calendar_date

getCharacterback to summary
public Character getCharacter(int col) throws HibernateException

Convenience method to read a character

getClobback to summary
public Clob getClob(int col) throws HibernateException

Convenience method to read a clob

getDateback to summary
public Date getDate(int col) throws HibernateException

Convenience method to read a date, time or timestamp

getDoubleback to summary
public Double getDouble(int col) throws HibernateException

Convenience method to read a double

getFloatback to summary
public Float getFloat(int col) throws HibernateException

Convenience method to read a float

getIntegerback to summary
public Integer getInteger(int col) throws HibernateException

Convenience method to read an integer

getLocaleback to summary
public Locale getLocale(int col) throws HibernateException

Convenience method to read a locale

getLongback to summary
public Long getLong(int col) throws HibernateException

Convenience method to read a long

getRowNumberback to summary
public int getRowNumber() throws HibernateException

Get the current location in the result set. The first row is number 0, contrary to JDBC.

Returns:int

the row number, numbered from 0, or -1 if there is no current row

getShortback to summary
public Short getShort(int col) throws HibernateException

Convenience method to read a short

getStringback to summary
public String getString(int col) throws HibernateException

Convenience method to read a string

getTextback to summary
public String getText(int col) throws HibernateException

Convenience method to read text

getTimeZoneback to summary
public TimeZone getTimeZone(int col) throws HibernateException

Convenience method to read a timezone

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

isFirstback to summary
public boolean isFirst() throws HibernateException

Is this the first result?

Returns:boolean

true if this is the first row of results

isLastback to summary
public boolean isLast() throws HibernateException

Is this the last result?

Returns:boolean

true if this is the last row of results

lastback to summary
public boolean last() throws HibernateException

Go to the last result

Returns:boolean

true if there are any results

nextback to summary
public boolean next() throws HibernateException

Advance to the next result

Returns:boolean

true if there is another result

previousback to summary
public boolean previous() throws HibernateException

Retreat to the previous result

Returns:boolean

true if there is a previous result

scrollback to summary
public boolean scroll(int i) throws HibernateException

Scroll an arbitrary number of locations

Parameters
i: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) throws HibernateException

Set the current location in the result set, numbered from either the first row (row number 0), or the last row (row number -1).

Parameters
rowNumber:int

the row number, numbered from the last row, in the case of a negative row number

Returns:boolean

true if there is a row at that row number