org.hibernate.impl

Class FetchingScrollableResultsImpl

Implemented Interfaces:
ScrollableResults

public class FetchingScrollableResultsImpl
extends AbstractScrollableResults

Implementation of ScrollableResults which can handle collection fetches.
Author:
Steve Ebersole

Constructor Summary

FetchingScrollableResultsImpl(ResultSet rs, PreparedStatement ps, SessionImplementor sess, Loader loader, QueryParameters queryParameters, Type[] types, HolderInstantiator holderInstantiator)

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)
boolean
first()
Go to the first result
protected Object[]
getCurrentRow()
int
getRowNumber()
Get the current location in the result set.
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 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).

Methods inherited from class org.hibernate.impl.AbstractScrollableResults

afterScrollOperation, close, get, get, getBigDecimal, getBigInteger, getBinary, getBlob, getBoolean, getByte, getCalendar, getCharacter, getClob, getCurrentRow, getDate, getDouble, getFinal, getFloat, getHolderInstantiator, getInteger, getLoader, getLocale, getLong, getNonFinal, getPs, getQueryParameters, getResultSet, getSession, getShort, getString, getText, getTimeZone, getType, getTypes

Constructor Details

FetchingScrollableResultsImpl

public FetchingScrollableResultsImpl(ResultSet rs,
                                     PreparedStatement ps,
                                     SessionImplementor sess,
                                     Loader loader,
                                     QueryParameters queryParameters,
                                     Type[] types,
                                     HolderInstantiator holderInstantiator)
            throws MappingException

Method Details

afterLast

public void afterLast()
            throws HibernateException
Go to a location just after the last result
Specified by:
afterLast in interface ScrollableResults

beforeFirst

public void beforeFirst()
            throws HibernateException
Go to a location just before first result (this is the initial location)
Specified by:
beforeFirst in interface ScrollableResults

first

public boolean first()
            throws HibernateException
Go to the first result
Specified by:
first in interface ScrollableResults
Returns:
true if there are any results

getCurrentRow

protected Object[] getCurrentRow()
Overrides:
getCurrentRow in interface AbstractScrollableResults

getRowNumber

public int getRowNumber()
            throws HibernateException
Get the current location in the result set. The first row is number 0, contrary to JDBC.
Specified by:
getRowNumber in interface ScrollableResults
Returns:
the row number, numbered from 0, or -1 if there is no current row

isFirst

public boolean isFirst()
            throws HibernateException
Is this the first result?
Specified by:
isFirst in interface ScrollableResults
Returns:
true if this is the first row of results

isLast

public boolean isLast()
            throws HibernateException
Is this the last result?
Specified by:
isLast in interface ScrollableResults
Returns:
true if this is the last row of results

last

public boolean last()
            throws HibernateException
Go to the last result
Specified by:
last in interface ScrollableResults
Returns:
true if there are any results

next

public boolean next()
            throws HibernateException
Advance to the next result
Specified by:
next in interface ScrollableResults
Returns:
true if there is another result

previous

public boolean previous()
            throws HibernateException
Retreat to the previous result
Specified by:
previous in interface ScrollableResults
Returns:
true if there is a previous result

scroll

public boolean scroll(int positions)
            throws HibernateException
Scroll an arbitrary number of locations
Specified by:
scroll in interface ScrollableResults
Parameters:
positions - a positive (forward) or negative (backward) number of rows
Returns:
true if there is a result at the new location

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).
Specified by:
setRowNumber in interface ScrollableResults
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