private class AdaptiveQuery.DynamicResults extends java.lang.Object implements Results
Results
interface which uses a single
table or multi-table DynamicQuery
as a delegate. An
instance of this method replaces the enclosing query's preselected
results when a DMO state change invalidates those results. If a single
table must be accessed, a modified RandomAccessQuery
is
used as a delegate. For multiple tables, a CompoundQuery
is used.
The adaptive query's original query components are interrogated for their properties in order to create the dynamic query (and its components in the multi-table case).
Modifier and Type | Field and Description |
---|---|
private RecordBuffer[] |
buffers
All buffers being updated by the dynamic query
|
private boolean |
closed
Flag indicating this results object has been closed
|
private boolean[] |
idOnly
ID-only flags, ordered by column
|
private DynamicQuery |
query
Underlying query which manages the navigation of results
|
Constructor and Description |
---|
DynamicResults(DynamicQuery query,
boolean[] idOnly)
Constructor which accepts a backing, dynamic query and turns
scrolling on for that query.
|
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 boolean |
postFetch(boolean revalidate)
Optionally switch the enclosing back to preselect mode if possible
and provide a return value which indicates whether the results object
currently is positioned on a row.
|
boolean |
previous()
Move cursor to the previous results row.
|
private void |
reposition(int row)
Reposition the backing query to the given 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 DynamicQuery query
private final RecordBuffer[] buffers
private final boolean[] idOnly
private boolean closed
DynamicResults(DynamicQuery query, boolean[] idOnly) throws PersistenceException
query
- Dynamic query which will back this results object.PersistenceException
- if there is an error beginning a new transaction.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
0
by
default if the cursor's position is not currently known.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 reposition(int row)
row
- Zero-based index of the target row.private boolean postFetch(boolean revalidate)
revalidate
- true
if query should attempt to switch back to
preselect mode, else false
. The switch should
only be made if the last operation moved forward through the
query's results.true
if positioned on a row, else
false
if off-end.