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
 java.lang.Object[] get()
          Get the current row of results
 java.lang.Object get(int i)
          Get the ith object in the current row of results, without initializing any other results in the row.
 java.math.BigDecimal getBigDecimal(int col)
          Convenience method to read a big_decimal
 java.math.BigInteger getBigInteger(int col)
          Convenience method to read a big_integer
 byte[] getBinary(int col)
          Convenience method to read a binary
 java.sql.Blob getBlob(int col)
          Convenience method to read a blob
 java.lang.Boolean getBoolean(int col)
          Convenience method to read a boolean
 java.lang.Byte getByte(int col)
          Convenience method to read a byte
 java.util.Calendar getCalendar(int col)
          Convenience method to read a calendar or calendar_date
 java.lang.Character getCharacter(int col)
          Convenience method to read a character
 java.sql.Clob getClob(int col)
          Convenience method to read a clob
 java.util.Date getDate(int col)
          Convenience method to read a date, time or timestamp
 java.lang.Double getDouble(int col)
          Convenience method to read a double
 java.lang.Float getFloat(int col)
          Convenience method to read a float
 java.lang.Integer getInteger(int col)
          Convenience method to read an integer
 java.util.Locale getLocale(int col)
          Convenience method to read a locale
 java.lang.Long getLong(int col)
          Convenience method to read a long
 int getRowNumber()
          Get the current location in the result set.
 java.lang.Short getShort(int col)
          Convenience method to read a short
 java.lang.String getString(int col)
          Convenience method to read a string
 java.lang.String getText(int col)
          Convenience method to read text
 java.util.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

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

Returns:
an object or array
Throws:
HibernateException

get

java.lang.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

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

Throws:
HibernateException

getLong

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

Throws:
HibernateException

getFloat

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

Throws:
HibernateException

getBoolean

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

Throws:
HibernateException

getDouble

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

Throws:
HibernateException

getShort

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

Throws:
HibernateException

getByte

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

Throws:
HibernateException

getCharacter

java.lang.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

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

Throws:
HibernateException

getBlob

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

Throws:
HibernateException

getClob

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

Throws:
HibernateException

getString

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

Throws:
HibernateException

getBigDecimal

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

Throws:
HibernateException

getBigInteger

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

Throws:
HibernateException

getDate

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

Throws:
HibernateException

getLocale

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

Throws:
HibernateException

getCalendar

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

Throws:
HibernateException

getTimeZone

java.util.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


Copyright © 2008 Hibernate.org. All Rights Reserved.