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 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()
           
 Object[] get()
           
 Object get(int i)
          This method is not supported on Lucene based queries
 BigDecimal getBigDecimal(int col)
          This method is not supported on Lucene based queries
 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
 Blob getBlob(int col)
          This method is not supported on Lucene based queries
 Boolean getBoolean(int col)
          This method is not supported on Lucene based queries
 Byte getByte(int col)
          This method is not supported on Lucene based queries
 Calendar getCalendar(int col)
          This method is not supported on Lucene based queries
 Character getCharacter(int col)
          This method is not supported on Lucene based queries
 Clob getClob(int col)
          This method is not supported on Lucene based queries
 Date getDate(int col)
          This method is not supported on Lucene based queries
 Double getDouble(int col)
          This method is not supported on Lucene based queries
 Float getFloat(int col)
          This method is not supported on Lucene based queries
 Integer getInteger(int col)
          This method is not supported on Lucene based queries
 Locale getLocale(int col)
          This method is not supported on Lucene based queries
 Long getLong(int col)
          This method is not supported on Lucene based queries
 int getRowNumber()
           
 Short getShort(int col)
          This method is not supported on Lucene based queries
 String getString(int col)
          This method is not supported on Lucene based queries
 String getText(int col)
          This method is not supported on Lucene based queries
 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 Object[] get()
             throws org.hibernate.HibernateException
Specified by:
get in interface org.hibernate.ScrollableResults
Throws:
org.hibernate.HibernateException

get

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

Specified by:
get in interface org.hibernate.ScrollableResults
Throws:
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:
UnsupportedOperationException - always thrown

getInteger

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

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

getLong

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

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

getFloat

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

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

getBoolean

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

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

getDouble

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

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

getShort

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

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

getByte

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

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

getCharacter

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

Specified by:
getCharacter in interface org.hibernate.ScrollableResults
Throws:
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:
UnsupportedOperationException - always thrown

getText

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

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

getBlob

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

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

getClob

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

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

getString

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

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

getBigDecimal

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

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

getBigInteger

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

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

getDate

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

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

getLocale

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

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

getCalendar

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

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

getTimeZone

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

Specified by:
getTimeZone in interface org.hibernate.ScrollableResults
Throws:
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 © 2011 Hibernate. All Rights Reserved.