alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Hibernate example source code file (ScrollableResults.java)

This example Hibernate source code file (ScrollableResults.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Hibernate tags/keywords

bigdecimal, boolean, character, clob, date, date, float, hibernateexception, hibernateexception, jdbc, math, object, object, sql, string, string, type, util

The Hibernate ScrollableResults.java source code

/*
 * Hibernate, Relational Persistence for Idiomatic Java
 *
 * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
 * indicated by the @author tags or express copyright attribution
 * statements applied by the authors.  All third-party contributions are
 * distributed under license by Red Hat Middleware LLC.
 *
 * This copyrighted material is made available to anyone wishing to use, modify,
 * copy, or redistribute it subject to the terms and conditions of the GNU
 * Lesser General Public License, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this distribution; if not, write to:
 * Free Software Foundation, Inc.
 * 51 Franklin Street, Fifth Floor
 * Boston, MA  02110-1301  USA
 *
 */
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 <tt>Query / ScrollableResults
 * pattern is very similar to the JDBC <tt>PreparedStatement/
 * <tt>ResultSet pattern and the semantics of methods of this interface
 * are similar to the similarly named methods on <tt>ResultSet.
* <br> * 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 <tt>true if there is another result */ public boolean next() throws HibernateException; /** * Retreat to the previous result * @return <tt>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 <tt>true if there is a result at the new location */ public boolean scroll(int i) throws HibernateException; /** * Go to the last result * @return <tt>true if there are any results */ public boolean last() throws HibernateException; /** * Go to the first result * @return <tt>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 <tt>true if this is the first row of results * @throws HibernateException */ public boolean isFirst() throws HibernateException; /** * Is this the last result? * * @return <tt>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 <tt>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 <tt>null */ public Object get(int i) throws HibernateException; /** * Get the type of the <tt>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 <tt>integer */ public Integer getInteger(int col) throws HibernateException; /** * Convenience method to read a <tt>long */ public Long getLong(int col) throws HibernateException; /** * Convenience method to read a <tt>float */ public Float getFloat(int col) throws HibernateException; /** * Convenience method to read a <tt>boolean */ public Boolean getBoolean(int col) throws HibernateException; /** * Convenience method to read a <tt>double */ public Double getDouble(int col) throws HibernateException; /** * Convenience method to read a <tt>short */ public Short getShort(int col) throws HibernateException; /** * Convenience method to read a <tt>byte */ public Byte getByte(int col) throws HibernateException; /** * Convenience method to read a <tt>character */ public Character getCharacter(int col) throws HibernateException; /** * Convenience method to read a <tt>binary */ public byte[] getBinary(int col) throws HibernateException; /** * Convenience method to read <tt>text */ public String getText(int col) throws HibernateException; /** * Convenience method to read a <tt>blob */ public Blob getBlob(int col) throws HibernateException; /** * Convenience method to read a <tt>clob */ public Clob getClob(int col) throws HibernateException; /** * Convenience method to read a <tt>string */ public String getString(int col) throws HibernateException; /** * Convenience method to read a <tt>big_decimal */ public BigDecimal getBigDecimal(int col) throws HibernateException; /** * Convenience method to read a <tt>big_integer */ public BigInteger getBigInteger(int col) throws HibernateException; /** * Convenience method to read a <tt>date, time or timestamp */ public Date getDate(int col) throws HibernateException; /** * Convenience method to read a <tt>locale */ public Locale getLocale(int col) throws HibernateException; /** * Convenience method to read a <tt>calendar or calendar_date */ public Calendar getCalendar(int col) throws HibernateException; /** * Convenience method to read a <tt>currency */ //public Currency getCurrency(int col) throws HibernateException; /** * Convenience method to read a <tt>timezone */ public TimeZone getTimeZone(int col) throws HibernateException; /** * Get the current location in the result set. The first * row is number <tt>0, contrary to JDBC. * @return the row number, numbered from <tt>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 <tt>0), or the last row (row * number <tt>-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; }

Other Hibernate examples (source code examples)

Here is a short list of links related to this Hibernate ScrollableResults.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.