private static class PreselectQuery.TemplateResults extends java.lang.Object implements Results
Results
implementation for template records. Since a query on rowid/recid
will return only a single row, this class is built around its Serializable
rowid
and provide fast access for a PreselectQuery
aware of this query type to iterate
on this single-row result.Modifier and Type | Field and Description |
---|---|
private int |
cursor
The position of the cursor.
|
private java.io.Serializable |
templateRowid
The id of the template record to be loaded.
|
Constructor and Description |
---|
TemplateResults(java.io.Serializable templateRowid)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Clean up and release any resources which this object is holding, such as open result
sets.
|
boolean |
first()
Move cursor to the first results row.
|
java.lang.Object[] |
get()
Get the array of objects at the current result row.
|
java.lang.Object |
get(int column)
Get the object at the current result row, at the specified column.
|
java.io.Serializable |
getID(int column)
Get the primary key ID at the current result row, at the specified
column.
|
int |
getRowNumber()
Get the row number currently under the cursor.
|
boolean |
isFirst()
Is the cursor on the first row in the results set?
|
boolean |
isLast()
Is the cursor on the last row in the results set?
|
boolean |
last()
Move cursor to the last results row.
|
boolean |
next()
Move cursor to the next results row.
|
private void |
normalize()
Internal worker that keeps the correctness of cursor position: always in one of the
positions: -1 = before the first record, 0 = the only record is selected, +1, after the
last record.
|
boolean |
previous()
Move cursor to the previous results row.
|
void |
reset()
Reset the cursor to its natural starting position, before the first result row.
|
boolean |
scroll(int rows)
Scroll the cursor ahead by the specified number of rows.
|
void |
sessionClosing()
Invoked when the current Hibernate session is about to close.
|
boolean |
setRowNumber(int row)
Set the row number currently under the cursor.
|
private final java.io.Serializable templateRowid
private int cursor
public TemplateResults(java.io.Serializable templateRowid)
Results
specific to a template rowid.templateRowid
- The rowid of the template record. Immutable.public boolean first()
public boolean last()
public boolean next()
public boolean previous()
public boolean isFirst()
public boolean isLast()
public java.lang.Object[] get()
public java.lang.Object get(int column)
public java.io.Serializable getID(int column)
public int getRowNumber()
getRowNumber
in interface Results
-1
if the cursor is not
currently on a result.public boolean setRowNumber(int row)
setRowNumber
in interface Results
row
- Zero-based index of the row to be set as the current row.true
if there is a row at the specified row number; else false
.public boolean scroll(int rows)
public void reset()
public void sessionClosing()
sessionClosing
in interface Results
public void cleanup()
private void normalize()