org.hibernate
Interface ScrollableResults

All Known Implementing Classes:
AbstractScrollableResults, FetchingScrollableResultsImpl, ScrollableResultsImpl

public interface ScrollableResults

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
 void afterLast()
          Go to a location just after the last result
 void beforeFirst()
          Go to a location just before first result (this is the initial location)
 void close()
          Release resources immediately.
 boolean first()
          Go to the first result
 Object[] get()
          Get the current row of results
 Object get(int i)
          Get the ith object in the current row of results, without initializing any other results in the row.
 BigDecimal getBigDecimal(int col)
          Convenience method to read a big_decimal
 BigInteger getBigInteger(int col)
          Convenience method to read a big_integer
 byte[] getBinary(int col)
          Convenience method to read a binary
 Blob getBlob(int col)
          Convenience method to read a blob
 Boolean getBoolean(int col)
          Convenience method to read a boolean
 Byte getByte(int col)
          Convenience method to read a byte
 Calendar getCalendar(int col)
          Convenience method to read a calendar or calendar_date
 Character getCharacter(int col)
          Convenience method to read a character
 Clob getClob(int col)
          Convenience method to read a clob
 Date getDate(int col)
          Convenience method to read a date, time or timestamp
 Double getDouble(int col)
          Convenience method to read a double
 Float getFloat(int col)
          Convenience method to read a float
 Integer getInteger(int col)
          Convenience method to read an integer
 Locale getLocale(int col)
          Convenience method to read a locale
 Long getLong(int col)
          Convenience method to read a long
 int getRowNumber()
          Get the current location in the result set.
 Short getShort(int col)
          Convenience method to read a short
 String getString(int col)
          Convenience method to read a string
 String getText(int col)
          Convenience method to read text
 TimeZone getTimeZone(int col)
          Convenience method to read a timezone
 Type getType(int i)
          Get the type of the ith column of results
 boolean isFirst()
          Is this the first result?
 boolean isLast()
          Is this the last result?
 boolean last()
          Go to the last result
 boolean next()
          Advance to the next result
 boolean previous()
          Retreat to the previous result
 boolean scroll(int i)
          Scroll an arbitrary number of locations
 boolean setRowNumber(int 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

next

boolean next()
             throws HibernateException
Advance to the next result

Returns:
true if there is another result
Throws:
HibernateException

previous

boolean previous()
                 throws HibernateException
Retreat to the previous result

Returns:
true if there is a previous result
Throws:
HibernateException

scroll

boolean scroll(int i)
               throws HibernateException
Scroll an arbitrary number of locations

Parameters:
i - a positive (forward) or negative (backward) number of rows
Returns:
true if there is a result at the new location
Throws:
HibernateException

last

boolean last()
             throws HibernateException
Go to the last result

Returns:
true if there are any results
Throws:
HibernateException

first

boolean first()
              throws HibernateException
Go to the first result

Returns:
true if there are any results
Throws:
HibernateException

beforeFirst

void beforeFirst()
                 throws HibernateException
Go to a location just before first result (this is the initial location)

Throws:
HibernateException

afterLast

void afterLast()
               throws HibernateException
Go to a location just after the last result

Throws:
HibernateException

isFirst

boolean isFirst()
                throws HibernateException
Is this the first result?

Returns:
true if this is the first row of results
Throws:
HibernateException

isLast

boolean isLast()
               throws HibernateException
Is this the last result?

Returns:
true if this is the last row of results
Throws:
HibernateException

close

void close()
           throws HibernateException
Release resources immediately.

Throws:
HibernateException

get

Object[] get()
             throws HibernateException
Get the current row of results

Returns:
an object or array
Throws:
HibernateException

get

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 - the column, numbered from zero
Returns:
an object of any Hibernate type or null
Throws:
HibernateException

getType

Type getType(int i)
Get the type of the ith column of results

Parameters:
i - the column, numbered from zero
Returns:
the Hibernate type

getInteger

Integer getInteger(int col)
                   throws HibernateException
Convenience method to read an integer

Throws:
HibernateException

getLong

Long getLong(int col)
             throws HibernateException
Convenience method to read a long

Throws:
HibernateException

getFloat

Float getFloat(int col)
               throws HibernateException
Convenience method to read a float

Throws:
HibernateException

getBoolean

Boolean getBoolean(int col)
                   throws HibernateException
Convenience method to read a boolean

Throws:
HibernateException

getDouble

Double getDouble(int col)
                 throws HibernateException
Convenience method to read a double

Throws:
HibernateException

getShort

Short getShort(int col)
               throws HibernateException
Convenience method to read a short

Throws:
HibernateException

getByte

Byte getByte(int col)
             throws HibernateException
Convenience method to read a byte

Throws:
HibernateException

getCharacter

Character getCharacter(int col)
                       throws HibernateException
Convenience method to read a character

Throws:
HibernateException

getBinary

byte[] getBinary(int col)
                 throws HibernateException
Convenience method to read a binary

Throws:
HibernateException

getText

String getText(int col)
               throws HibernateException
Convenience method to read text

Throws:
HibernateException

getBlob

Blob getBlob(int col)
             throws HibernateException
Convenience method to read a blob

Throws:
HibernateException

getClob

Clob getClob(int col)
             throws HibernateException
Convenience method to read a clob

Throws:
HibernateException

getString

String getString(int col)
                 throws HibernateException
Convenience method to read a string

Throws:
HibernateException

getBigDecimal

BigDecimal getBigDecimal(int col)
                         throws HibernateException
Convenience method to read a big_decimal

Throws:
HibernateException

getBigInteger

BigInteger getBigInteger(int col)
                         throws HibernateException
Convenience method to read a big_integer

Throws:
HibernateException

getDate

Date getDate(int col)
             throws HibernateException
Convenience method to read a date, time or timestamp

Throws:
HibernateException

getLocale

Locale getLocale(int col)
                 throws HibernateException
Convenience method to read a locale

Throws:
HibernateException

getCalendar

Calendar getCalendar(int col)
                     throws HibernateException
Convenience method to read a calendar or calendar_date

Throws:
HibernateException

getTimeZone

TimeZone getTimeZone(int col)
                     throws HibernateException
Convenience method to read a timezone

Throws:
HibernateException

getRowNumber

int getRowNumber()
                 throws HibernateException
Get the current location in the result set. The first row is number 0, contrary to JDBC.

Returns:
the row number, numbered from 0, or -1 if there is no current row
Throws:
HibernateException

setRowNumber

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 - the row number, numbered from the last row, in the case of a negative row number
Returns:
true if there is a row at that row number
Throws:
HibernateException