Package org.hibernate.internal
Class EmptyScrollableResults<R>
java.lang.Object
org.hibernate.internal.EmptyScrollableResults<R>
- All Implemented Interfaces:
AutoCloseable,ScrollableResultsImplementor<R>,ScrollableResults<R>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidGo to a location just after the last result.voidGo to a location just before first result.voidclose()Release resources immediately.booleanfirst()Go to the first result.get()Get the current row of results.intThe current position within the query results.intGet the current position in the results, with the first position labelled as row number0.static <R> EmptyScrollableResults<R> instance()booleanisClosed()booleanisFirst()Is this the first result?booleanisLast()Is this the last result?booleanlast()Go to the last result.booleannext()Advance to the next result.booleanposition(int position) Moves the result cursor to the specified position.booleanprevious()Retreat to the previous result.booleanscroll(int positions) Scroll the specified number of positions from the current position.voidsetFetchSize(int fetchSize) Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed.booleansetRowNumber(int rowNumber) Set the current position in the result set, with the first position labelled as row number1, and the last position labelled as row number-1.
-
Constructor Details
-
EmptyScrollableResults
public EmptyScrollableResults()
-
-
Method Details
-
instance
-
isClosed
public boolean isClosed()- Specified by:
isClosedin interfaceScrollableResults<R>- Returns:
trueifScrollableResults.close()was already called
-
close
public void close()Description copied from interface:ScrollableResultsRelease resources immediately.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceScrollableResults<R>
-
next
public boolean next()Description copied from interface:ScrollableResultsAdvance to the next result.- Specified by:
nextin interfaceScrollableResults<R>- Returns:
trueif there is another result
-
previous
public boolean previous()Description copied from interface:ScrollableResultsRetreat to the previous result.- Specified by:
previousin interfaceScrollableResults<R>- Returns:
trueif there is a previous result
-
scroll
public boolean scroll(int positions) Description copied from interface:ScrollableResultsScroll the specified number of positions from the current position.- Specified by:
scrollin interfaceScrollableResults<R>- Parameters:
positions- a positive (forward) or negative (backward) number of positions- Returns:
trueif there is a result at the new location
-
position
public boolean position(int position) Description copied from interface:ScrollableResultsMoves the result cursor to the specified position. The index may be a positive value, and the position may be reached by counting forward from the first result at position1, or it may be a negative value, so that the position may be reached by counting backward from the last result at position-1.- Specified by:
positionin interfaceScrollableResults<R>- Parameters:
position- an absolute positive (from the start) or negative (from the end) position within the query results- Returns:
trueif there is a result at the new location
-
last
public boolean last()Description copied from interface:ScrollableResultsGo to the last result.- Specified by:
lastin interfaceScrollableResults<R>- Returns:
trueif there are any results
-
first
public boolean first()Description copied from interface:ScrollableResultsGo to the first result.- Specified by:
firstin interfaceScrollableResults<R>- Returns:
trueif there are any results
-
beforeFirst
public void beforeFirst()Description copied from interface:ScrollableResultsGo to a location just before first result.This is the location of the cursor on a newly returned scrollable result.
- Specified by:
beforeFirstin interfaceScrollableResults<R>
-
afterLast
public void afterLast()Description copied from interface:ScrollableResultsGo to a location just after the last result.- Specified by:
afterLastin interfaceScrollableResults<R>
-
isFirst
public boolean isFirst()Description copied from interface:ScrollableResultsIs this the first result?- Specified by:
isFirstin interfaceScrollableResults<R>- Returns:
trueif this is the first row of results, otherwisefalse
-
isLast
public boolean isLast()Description copied from interface:ScrollableResultsIs this the last result?- Specified by:
isLastin interfaceScrollableResults<R>- Returns:
trueif this is the last row of results.
-
getRowNumber
public int getRowNumber()Description copied from interface:ScrollableResultsGet the current position in the results, with the first position labelled as row number0. That is, this operation returnsposition-1.- Specified by:
getRowNumberin interfaceScrollableResults<R>- Returns:
- The current position number, numbered from
0;-1indicates that there is no current row
-
getPosition
public int getPosition()Description copied from interface:ScrollableResultsThe current position within the query results. The first query result, if any, is at position1. An empty or newly-created instance has position0.- Specified by:
getPositionin interfaceScrollableResults<R>- Returns:
- the current position, a positive integer index
starting at
1, or0if this instance is empty or newly-created
-
setRowNumber
public boolean setRowNumber(int rowNumber) Description copied from interface:ScrollableResultsSet the current position in the result set, with the first position labelled as row number1, and the last position labelled as row number-1. Results may be numbered from the first result (using a positive position) or backward from the last result (using a negative position).- Specified by:
setRowNumberin interfaceScrollableResults<R>- Parameters:
rowNumber- the row number. A positive number indicates a value numbered from the first row; a negative number indicates a value numbered from the last row.- Returns:
- true if there is a row at that row number
-
setFetchSize
public void setFetchSize(int fetchSize) Description copied from interface:ScrollableResultsGives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed. If0, the JDBC driver's default setting will be used.- Specified by:
setFetchSizein interfaceScrollableResults<R>- See Also:
-
get
Description copied from interface:ScrollableResultsGet the current row of results.- Specified by:
getin interfaceScrollableResults<R>- Returns:
- The array of results
-