org.hibernate.ScrollableResults Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate Show documentation
Show all versions of hibernate Show documentation
Relational Persistence for Java
//$Id: ScrollableResults.java 6411 2005-04-13 07:37:50Z oneovthafew $
package org.hibernate;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Blob;
import java.sql.Clob;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
import org.hibernate.type.Type;
/**
* 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.
*
* @see Query#scroll()
* @author Gavin King
*/
public interface ScrollableResults {
/**
* Advance to the next result
* @return true if there is another result
*/
public boolean next() throws HibernateException;
/**
* Retreat to the previous result
* @return true if there is a previous result
*/
public boolean previous() throws HibernateException;
/**
* Scroll an arbitrary number of locations
* @param i a positive (forward) or negative (backward) number of rows
* @return true if there is a result at the new location
*/
public boolean scroll(int i) throws HibernateException;
/**
* Go to the last result
* @return true if there are any results
*/
public boolean last() throws HibernateException;
/**
* Go to the first result
* @return true if there are any results
*/
public boolean first() throws HibernateException;
/**
* Go to a location just before first result (this is the initial location)
*/
public void beforeFirst() throws HibernateException;
/**
* Go to a location just after the last result
*/
public void afterLast() throws HibernateException;
/**
* Is this the first result?
*
* @return true if this is the first row of results
* @throws HibernateException
*/
public boolean isFirst() throws HibernateException;
/**
* Is this the last result?
*
* @return true if this is the last row of results
* @throws HibernateException
*/
public boolean isLast() throws HibernateException;
/**
* Release resources immediately.
*/
public void close() throws HibernateException;
/**
* Get the current row of results
* @return an object or array
*/
public Object[] get() 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).
* @param i the column, numbered from zero
* @return an object of any Hibernate type or null
*/
public Object get(int i) throws HibernateException;
/**
* Get the type of the ith column of results
* @param i the column, numbered from zero
* @return the Hibernate type
*/
public Type getType(int i);
/**
* Convenience method to read an integer
*/
public Integer getInteger(int col) throws HibernateException;
/**
* Convenience method to read a long
*/
public Long getLong(int col) throws HibernateException;
/**
* Convenience method to read a float
*/
public Float getFloat(int col) throws HibernateException;
/**
* Convenience method to read a boolean
*/
public Boolean getBoolean(int col) throws HibernateException;
/**
* Convenience method to read a double
*/
public Double getDouble(int col) throws HibernateException;
/**
* Convenience method to read a short
*/
public Short getShort(int col) throws HibernateException;
/**
* Convenience method to read a byte
*/
public Byte getByte(int col) throws HibernateException;
/**
* Convenience method to read a character
*/
public Character getCharacter(int col) throws HibernateException;
/**
* Convenience method to read a binary
*/
public byte[] getBinary(int col) throws HibernateException;
/**
* Convenience method to read text
*/
public String getText(int col) throws HibernateException;
/**
* Convenience method to read a blob
*/
public Blob getBlob(int col) throws HibernateException;
/**
* Convenience method to read a clob
*/
public Clob getClob(int col) throws HibernateException;
/**
* Convenience method to read a string
*/
public String getString(int col) throws HibernateException;
/**
* Convenience method to read a big_decimal
*/
public BigDecimal getBigDecimal(int col) throws HibernateException;
/**
* Convenience method to read a big_integer
*/
public BigInteger getBigInteger(int col) throws HibernateException;
/**
* Convenience method to read a date, time or timestamp
*/
public Date getDate(int col) throws HibernateException;
/**
* Convenience method to read a locale
*/
public Locale getLocale(int col) throws HibernateException;
/**
* Convenience method to read a calendar or calendar_date
*/
public Calendar getCalendar(int col) throws HibernateException;
/**
* Convenience method to read a currency
*/
//public Currency getCurrency(int col) throws HibernateException;
/**
* Convenience method to read a timezone
*/
public TimeZone getTimeZone(int col) throws HibernateException;
/**
* Get the current location in the result set. The first
* row is number 0, contrary to JDBC.
* @return the row number, numbered from 0, or -1 if
* there is no current row
*/
public int getRowNumber() 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).
* @param rowNumber the row number, numbered from the last row, in the
* case of a negative row number
* @return true if there is a row at that row number
*/
public boolean setRowNumber(int rowNumber) throws HibernateException;
}