public interface ScrollableResults extends AutoCloseable, Closeable
A result iterator that allows moving around within the results by arbitrary increments. The <tt>Query</tt> / <tt>ScrollableResults</tt> pattern is very similar to the JDBC <tt>PreparedStatement</tt>/ <tt>ResultSet</tt> pattern and the semantics of methods of this interface are similar to the similarly named methods on <tt>ResultSet</tt>.<br> <br> Contrary to JDBC, columns of results are numbered from zero.
Query.scroll()
Modifier and Type | Method and Description |
---|---|
void |
afterLast()
Go to a location just after the last result.
|
void |
beforeFirst()
Go to a location just before first result, This is the location of the cursor on a newly returned
scrollable result.
|
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 <tt>i</tt>th object in the current row of results, without
initializing any other results in the row.
|
BigDecimal |
getBigDecimal(int col)
Convenience method to read a BigDecimal.
|
BigInteger |
getBigInteger(int col)
Convenience method to read a BigInteger.
|
byte[] |
getBinary(int col)
Convenience method to read a binary (byte[]).
|
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.
|
Character |
getCharacter(int col)
Convenience method to read a char.
|
Clob |
getClob(int col)
Convenience method to read a clob.
|
Date |
getDate(int col)
Convenience method to read a Date.
|
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 position in the results.
|
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 a String using streaming.
|
TimeZone |
getTimeZone(int col)
Convenience method to read a TimeZone.
|
Type |
getType(int i)
Get the type of the <tt>i</tt>th 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 positions)
Scroll the specified number of positions from the current position.
|
boolean |
setRowNumber(int rowNumber)
Set the current position in the result set.
|
void close()
Release resources immediately.
close
in interface AutoCloseable
close
in interface Closeable
boolean next()
Advance to the next result.
true
if there is another resultboolean previous()
Retreat to the previous result.
true
if there is a previous resultboolean scroll(int positions)
Scroll the specified number of positions from the current position.
positions
- a positive (forward) or negative (backward) number of rowstrue
if there is a result at the new locationboolean last()
Go to the last result.
true
if there are any resultsboolean first()
Go to the first result.
true
if there are any resultsvoid beforeFirst()
Go to a location just before first result, This is the location of the cursor on a newly returned scrollable result.
void afterLast()
Go to a location just after the last result.
boolean isFirst()
Is this the first result?
true
if this is the first row of results, otherwise false
boolean isLast()
Is this the last result?
true
if this is the last row of results.int getRowNumber()
Get the current position in the results. The first position is number 0 (unlike JDBC).
boolean setRowNumber(int rowNumber)
Set the current position in the result set. Can be numbered from the first position (positive number) or the last row (negative number).
rowNumber
- the row number. A positive number indicates a value numbered from the first row; a
negative number indicates a value numbered from the last row.Object[] get()
Get the current row of results.
Object get(int i)
Get the <tt>i</tt>th 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).
i
- the column, numbered from zeronull
IndexOutOfBoundsException
- If i is an invalid index.Type getType(int i)
Get the type of the <tt>i</tt>th column of results.
i
- the column, numbered from zeroIndexOutOfBoundsException
- If i is an invalid index.Integer getInteger(int col)
Convenience method to read an integer.
col
- The column, numbered from zeroIndexOutOfBoundsException
- If col is an invalid index.Long getLong(int col)
Convenience method to read a long.
col
- The column, numbered from zeroIndexOutOfBoundsException
- If col is an invalid index.Float getFloat(int col)
Convenience method to read a float.
col
- The column, numbered from zeroIndexOutOfBoundsException
- If col is an invalid index.Boolean getBoolean(int col)
Convenience method to read a boolean.
col
- The column, numbered from zeroIndexOutOfBoundsException
- If col is an invalid index.Double getDouble(int col)
Convenience method to read a double.
col
- The column, numbered from zeroIndexOutOfBoundsException
- If col is an invalid index.Short getShort(int col)
Convenience method to read a short.
col
- The column, numbered from zeroIndexOutOfBoundsException
- If col is an invalid index.Byte getByte(int col)
Convenience method to read a byte.
col
- The column, numbered from zeroIndexOutOfBoundsException
- If col is an invalid index.Character getCharacter(int col)
Convenience method to read a char.
col
- The column, numbered from zeroIndexOutOfBoundsException
- If col is an invalid index.byte[] getBinary(int col)
Convenience method to read a binary (byte[]).
col
- The column, numbered from zeroIndexOutOfBoundsException
- If col is an invalid index.String getText(int col)
Convenience method to read a String using streaming.
col
- The column, numbered from zeroIndexOutOfBoundsException
- If col is an invalid index.Blob getBlob(int col)
Convenience method to read a blob.
col
- The column, numbered from zeroIndexOutOfBoundsException
- If col is an invalid index.Clob getClob(int col)
Convenience method to read a clob.
col
- The column, numbered from zeroIndexOutOfBoundsException
- If col is an invalid index.String getString(int col)
Convenience method to read a string.
col
- The column, numbered from zeroIndexOutOfBoundsException
- If col is an invalid index.BigDecimal getBigDecimal(int col)
Convenience method to read a BigDecimal.
col
- The column, numbered from zeroIndexOutOfBoundsException
- If col is an invalid index.BigInteger getBigInteger(int col)
Convenience method to read a BigInteger.
col
- The column, numbered from zeroIndexOutOfBoundsException
- If col is an invalid index.Date getDate(int col)
Convenience method to read a Date.
col
- The column, numbered from zeroIndexOutOfBoundsException
- If col is an invalid index.Locale getLocale(int col)
Convenience method to read a Locale.
col
- The column, numbered from zeroIndexOutOfBoundsException
- If col is an invalid index.Calendar getCalendar(int col)
Convenience method to read a Calendar.
col
- The column, numbered from zeroIndexOutOfBoundsException
- If col is an invalid index.TimeZone getTimeZone(int col)
Convenience method to read a TimeZone.
col
- The column, numbered from zeroIndexOutOfBoundsException
- If col is an invalid index.Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.