Package 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.
Contrary to JDBC, columns of results are numbered from zero.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidGo to a location just after the last resultvoidGo to a location just before first result (this is the initial location)voidclose()Release resources immediately.booleanfirst()Go to the first resultObject[]get()Get the current row of resultsget(int i) Get the ith object in the current row of results, without initializing any other results in the row.getBigDecimal(int col) Convenience method to read a big_decimalgetBigInteger(int col) Convenience method to read a big_integerbyte[]getBinary(int col) Convenience method to read a binarygetBlob(int col) Convenience method to read a blobgetBoolean(int col) Convenience method to read a booleangetByte(int col) Convenience method to read a bytegetCalendar(int col) Convenience method to read a calendar or calendar_dategetCharacter(int col) Convenience method to read a charactergetClob(int col) Convenience method to read a clobgetDate(int col) Convenience method to read a date, time or timestampgetDouble(int col) Convenience method to read a doublegetFloat(int col) Convenience method to read a floatgetInteger(int col) Convenience method to read an integergetLocale(int col) Convenience method to read a localegetLong(int col) Convenience method to read a longintGet the current location in the result set.getShort(int col) Convenience method to read a shortgetString(int col) Convenience method to read a stringgetText(int col) Convenience method to read textgetTimeZone(int col) Convenience method to read a timezonegetType(int i) Get the type of the ith column of resultsbooleanisFirst()Is this the first result?booleanisLast()Is this the last result?booleanlast()Go to the last resultbooleannext()Advance to the next resultbooleanprevious()Retreat to the previous resultbooleanscroll(int i) Scroll an arbitrary number of locationsbooleansetRowNumber(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 Details
-
next
Advance to the next result- Returns:
- true if there is another result
- Throws:
HibernateException
-
previous
Retreat to the previous result- Returns:
- true if there is a previous result
- Throws:
HibernateException
-
scroll
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
Go to the last result- Returns:
- true if there are any results
- Throws:
HibernateException
-
first
Go to the first result- Returns:
- true if there are any results
- Throws:
HibernateException
-
beforeFirst
Go to a location just before first result (this is the initial location)- Throws:
HibernateException
-
afterLast
Go to a location just after the last result- Throws:
HibernateException
-
isFirst
Is this the first result?- Returns:
- true if this is the first row of results
- Throws:
HibernateException
-
isLast
Is this the last result?- Returns:
- true if this is the last row of results
- Throws:
HibernateException
-
close
Release resources immediately.- Throws:
HibernateException
-
get
Get the current row of results- Returns:
- an object or array
- Throws:
HibernateException
-
get
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
Get the type of the ith column of results- Parameters:
i- the column, numbered from zero- Returns:
- the Hibernate type
-
getInteger
Convenience method to read an integer- Throws:
HibernateException
-
getLong
Convenience method to read a long- Throws:
HibernateException
-
getFloat
Convenience method to read a float- Throws:
HibernateException
-
getBoolean
Convenience method to read a boolean- Throws:
HibernateException
-
getDouble
Convenience method to read a double- Throws:
HibernateException
-
getShort
Convenience method to read a short- Throws:
HibernateException
-
getByte
Convenience method to read a byte- Throws:
HibernateException
-
getCharacter
Convenience method to read a character- Throws:
HibernateException
-
getBinary
Convenience method to read a binary- Throws:
HibernateException
-
getText
Convenience method to read text- Throws:
HibernateException
-
getBlob
Convenience method to read a blob- Throws:
HibernateException
-
getClob
Convenience method to read a clob- Throws:
HibernateException
-
getString
Convenience method to read a string- Throws:
HibernateException
-
getBigDecimal
Convenience method to read a big_decimal- Throws:
HibernateException
-
getBigInteger
Convenience method to read a big_integer- Throws:
HibernateException
-
getDate
Convenience method to read a date, time or timestamp- Throws:
HibernateException
-
getLocale
Convenience method to read a locale- Throws:
HibernateException
-
getCalendar
Convenience method to read a calendar or calendar_date- Throws:
HibernateException
-
getTimeZone
Convenience method to read a timezone- Throws:
HibernateException
-
getRowNumber
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
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
-