org.hibernate.search.query
Class ScrollableResultsImpl

java.lang.Object
  extended by org.hibernate.search.query.ScrollableResultsImpl
All Implemented Interfaces:
org.hibernate.ScrollableResults

public class ScrollableResultsImpl
extends java.lang.Object
implements org.hibernate.ScrollableResults

Implements scrollable and paginated resultsets. Contrary to Query#iterate() or Query#list(), this implementation is exposed to returned null objects (if the index is out of date).

The following methods that change the value of 'current' will check and set its value to either 'afterLast' or 'beforeFirst' depending on direction. This is to prevent rogue values from setting it outside the boundaries of the results.

Author:
Emmanuel Bernard, John Griffin, Sanne Grinovero
See Also:
Query

Constructor Summary
ScrollableResultsImpl(org.apache.lucene.search.IndexSearcher searcher, int first, int max, int fetchSize, DocumentExtractor extractor, Loader loader, SearchFactory searchFactory, org.hibernate.engine.SessionImplementor sessionImplementor)
           
 
Method Summary
 void afterLast()
           
 void beforeFirst()
           
 void close()
           
 boolean first()
           
 java.lang.Object[] get()
           
 java.lang.Object get(int i)
          This method is not supported on Lucene based queries
 java.math.BigDecimal getBigDecimal(int col)
          This method is not supported on Lucene based queries
 java.math.BigInteger getBigInteger(int col)
          This method is not supported on Lucene based queries
 byte[] getBinary(int col)
          This method is not supported on Lucene based queries
 java.sql.Blob getBlob(int col)
          This method is not supported on Lucene based queries
 java.lang.Boolean getBoolean(int col)
          This method is not supported on Lucene based queries
 java.lang.Byte getByte(int col)
          This method is not supported on Lucene based queries
 java.util.Calendar getCalendar(int col)
          This method is not supported on Lucene based queries
 java.lang.Character getCharacter(int col)
          This method is not supported on Lucene based queries
 java.sql.Clob getClob(int col)
          This method is not supported on Lucene based queries
 java.util.Date getDate(int col)
          This method is not supported on Lucene based queries
 java.lang.Double getDouble(int col)
          This method is not supported on Lucene based queries
 java.lang.Float getFloat(int col)
          This method is not supported on Lucene based queries
 java.lang.Integer getInteger(int col)
          This method is not supported on Lucene based queries
 java.util.Locale getLocale(int col)
          This method is not supported on Lucene based queries
 java.lang.Long getLong(int col)
          This method is not supported on Lucene based queries
 int getRowNumber()
           
 java.lang.Short getShort(int col)
          This method is not supported on Lucene based queries
 java.lang.String getString(int col)
          This method is not supported on Lucene based queries
 java.lang.String getText(int col)
          This method is not supported on Lucene based queries
 java.util.TimeZone getTimeZone(int col)
          This method is not supported on Lucene based queries
 org.hibernate.type.Type getType(int i)
          This method is not supported on Lucene based queries
 boolean isFirst()
           
 boolean isLast()
           
 boolean last()
           
 boolean next()
          
 boolean previous()
           
 boolean scroll(int i)
           
 boolean setRowNumber(int rowNumber)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScrollableResultsImpl

public ScrollableResultsImpl(org.apache.lucene.search.IndexSearcher searcher,
                             int first,
                             int max,
                             int fetchSize,
                             DocumentExtractor extractor,
                             Loader loader,
                             SearchFactory searchFactory,
                             org.hibernate.engine.SessionImplementor sessionImplementor)
Method Detail

next

public boolean next()

Specified by:
next in interface org.hibernate.ScrollableResults

previous

public boolean previous()
Specified by:
previous in interface org.hibernate.ScrollableResults

scroll

public boolean scroll(int i)
Specified by:
scroll in interface org.hibernate.ScrollableResults

last

public boolean last()
Specified by:
last in interface org.hibernate.ScrollableResults

first

public boolean first()
Specified by:
first in interface org.hibernate.ScrollableResults

beforeFirst

public void beforeFirst()
Specified by:
beforeFirst in interface org.hibernate.ScrollableResults

afterLast

public void afterLast()
Specified by:
afterLast in interface org.hibernate.ScrollableResults

isFirst

public boolean isFirst()
Specified by:
isFirst in interface org.hibernate.ScrollableResults

isLast

public boolean isLast()
Specified by:
isLast in interface org.hibernate.ScrollableResults

close

public void close()
Specified by:
close in interface org.hibernate.ScrollableResults

get

public java.lang.Object[] get()
                       throws org.hibernate.HibernateException
Specified by:
get in interface org.hibernate.ScrollableResults
Throws:
org.hibernate.HibernateException

get

public java.lang.Object get(int i)
This method is not supported on Lucene based queries

Specified by:
get in interface org.hibernate.ScrollableResults
Throws:
java.lang.UnsupportedOperationException - always thrown

getType

public org.hibernate.type.Type getType(int i)
This method is not supported on Lucene based queries

Specified by:
getType in interface org.hibernate.ScrollableResults
Throws:
java.lang.UnsupportedOperationException - always thrown

getInteger

public java.lang.Integer getInteger(int col)
This method is not supported on Lucene based queries

Specified by:
getInteger in interface org.hibernate.ScrollableResults
Throws:
java.lang.UnsupportedOperationException - always thrown

getLong

public java.lang.Long getLong(int col)
This method is not supported on Lucene based queries

Specified by:
getLong in interface org.hibernate.ScrollableResults
Throws:
java.lang.UnsupportedOperationException - always thrown

getFloat

public java.lang.Float getFloat(int col)
This method is not supported on Lucene based queries

Specified by:
getFloat in interface org.hibernate.ScrollableResults
Throws:
java.lang.UnsupportedOperationException - always thrown

getBoolean

public java.lang.Boolean getBoolean(int col)
This method is not supported on Lucene based queries

Specified by:
getBoolean in interface org.hibernate.ScrollableResults
Throws:
java.lang.UnsupportedOperationException - always thrown

getDouble

public java.lang.Double getDouble(int col)
This method is not supported on Lucene based queries

Specified by:
getDouble in interface org.hibernate.ScrollableResults
Throws:
java.lang.UnsupportedOperationException - always thrown

getShort

public java.lang.Short getShort(int col)
This method is not supported on Lucene based queries

Specified by:
getShort in interface org.hibernate.ScrollableResults
Throws:
java.lang.UnsupportedOperationException - always thrown

getByte

public java.lang.Byte getByte(int col)
This method is not supported on Lucene based queries

Specified by:
getByte in interface org.hibernate.ScrollableResults
Throws:
java.lang.UnsupportedOperationException - always thrown

getCharacter

public java.lang.Character getCharacter(int col)
This method is not supported on Lucene based queries

Specified by:
getCharacter in interface org.hibernate.ScrollableResults
Throws:
java.lang.UnsupportedOperationException - always thrown

getBinary

public byte[] getBinary(int col)
This method is not supported on Lucene based queries

Specified by:
getBinary in interface org.hibernate.ScrollableResults
Throws:
java.lang.UnsupportedOperationException - always thrown

getText

public java.lang.String getText(int col)
This method is not supported on Lucene based queries

Specified by:
getText in interface org.hibernate.ScrollableResults
Throws:
java.lang.UnsupportedOperationException - always thrown

getBlob

public java.sql.Blob getBlob(int col)
This method is not supported on Lucene based queries

Specified by:
getBlob in interface org.hibernate.ScrollableResults
Throws:
java.lang.UnsupportedOperationException - always thrown

getClob

public java.sql.Clob getClob(int col)
This method is not supported on Lucene based queries

Specified by:
getClob in interface org.hibernate.ScrollableResults
Throws:
java.lang.UnsupportedOperationException - always thrown

getString

public java.lang.String getString(int col)
This method is not supported on Lucene based queries

Specified by:
getString in interface org.hibernate.ScrollableResults
Throws:
java.lang.UnsupportedOperationException - always thrown

getBigDecimal

public java.math.BigDecimal getBigDecimal(int col)
This method is not supported on Lucene based queries

Specified by:
getBigDecimal in interface org.hibernate.ScrollableResults
Throws:
java.lang.UnsupportedOperationException - always thrown

getBigInteger

public java.math.BigInteger getBigInteger(int col)
This method is not supported on Lucene based queries

Specified by:
getBigInteger in interface org.hibernate.ScrollableResults
Throws:
java.lang.UnsupportedOperationException - always thrown

getDate

public java.util.Date getDate(int col)
This method is not supported on Lucene based queries

Specified by:
getDate in interface org.hibernate.ScrollableResults
Throws:
java.lang.UnsupportedOperationException - always thrown

getLocale

public java.util.Locale getLocale(int col)
This method is not supported on Lucene based queries

Specified by:
getLocale in interface org.hibernate.ScrollableResults
Throws:
java.lang.UnsupportedOperationException - always thrown

getCalendar

public java.util.Calendar getCalendar(int col)
This method is not supported on Lucene based queries

Specified by:
getCalendar in interface org.hibernate.ScrollableResults
Throws:
java.lang.UnsupportedOperationException - always thrown

getTimeZone

public java.util.TimeZone getTimeZone(int col)
This method is not supported on Lucene based queries

Specified by:
getTimeZone in interface org.hibernate.ScrollableResults
Throws:
java.lang.UnsupportedOperationException - always thrown

getRowNumber

public int getRowNumber()
Specified by:
getRowNumber in interface org.hibernate.ScrollableResults

setRowNumber

public boolean setRowNumber(int rowNumber)
Specified by:
setRowNumber in interface org.hibernate.ScrollableResults


Copyright © 2006-2010 Hibernate. All Rights Reserved.