站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Hibernate 2.1.8 正式版 API 英文文档

ScrollableResults (Hibernate API Documentation) - Hibernate 2.1.8 正式版 API 英文文档


net.sf.hibernate
Interface ScrollableResults

All Known Implementing Classes:
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
 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

public boolean next()
             throws HibernateException
Advance to the next result

Returns:
true if there is another result
Throws:
HibernateException

previous

public boolean previous()
                 throws HibernateException
Retreat to the previous result

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

scroll

public 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

public boolean last()
             throws HibernateException
Go to the last result

Returns:
true if there are any results
Throws:
HibernateException

first

public boolean first()
              throws HibernateException
Go to the first result

Returns:
true if there are any results
Throws:
HibernateException

beforeFirst

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

Throws:
HibernateException

afterLast

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

Throws:
HibernateException

isFirst

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

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

isLast

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

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

close

public void close()
           throws HibernateException
Release resources immediately.

Throws:
HibernateException

get

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

Returns:
an object or array
Throws:
HibernateException

get

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

getType

public 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

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

Throws:
HibernateException

getLong

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

Throws:
HibernateException

getFloat

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

Throws:
HibernateException

getBoolean

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

Throws:
HibernateException

getDouble

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

Throws:
HibernateException

getShort

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

Throws:
HibernateException

getByte

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

Throws:
HibernateException

getCharacter

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

Throws:
HibernateException

getBinary

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

Throws:
HibernateException

getText

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

Throws:
HibernateException

getBlob

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

Throws:
HibernateException

getClob

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

Throws:
HibernateException

getString

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

Throws:
HibernateException

getBigDecimal

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

Throws:
HibernateException

getDate

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

Throws:
HibernateException

getLocale

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

Throws:
HibernateException

getCalendar

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

Throws:
HibernateException

getTimeZone

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

Throws:
HibernateException

getRowNumber

public 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

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 - 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