public class PreselectQuery extends AbstractQuery implements Joinable, QueryConstants, Finalizable, SessionListener
Joinable
interface, instances may be added as components of
a CompoundQuery
.
The query is lazily executed the first time a record retrieval/navigation method is invoked. Only the database identifiers (i.e., primary keys) of the records are retrieved by the initial query. On each subsequent fetch, a row in this result list is retrieved, where each column contains the primary key for the record associated with the corresponding query component. The record for each primary key is retrieved and stored in its associated buffer.
At this time, outer joins are not supported. Furthermore, components may only specify NEXT as their iteration type at this time. FIRST and LAST currently are not supported.
When used to represent a Progress query (created with DEFINE or OPEN
QUERY), lenient-off-end must be enabled at construction. This mode
suppresses end condition exceptions for next
and
previous
commands which run off the end of the query's
results.
This query may be integrated with a client-side where clause expression,
by passing a non-null
Supplier<logical>
argument
to one of the single-table constructor variants. Note that additional
components may not be added to an instance so created, since this type of
query must act against no more than one record buffer. If a multi-table
preselect query is called for, CompoundQuery
must be used,
though its components may be instances of this class.
Modifier and Type | Class and Description |
---|---|
private static class |
PreselectQuery.TemplateResults
Special
Results implementation for template records. |
P2JQuery.Parameter
SessionListener.Event, SessionListener.Scope
Modifier and Type | Field and Description |
---|---|
protected boolean |
betweenRows
Has query been repositioned between result rows?
|
protected java.util.List<QueryComponent> |
components
Components of the query; at least 1 is required
|
protected boolean |
currentRowDeleted
Determines if the current row was deleted by DELETE-RESULT-LIST-ENTRY.
|
private boolean |
fullRecords
Force query to retrieve full records, rather than primary keys only
|
private java.lang.String |
hql
HQL query string to retrieve primary key ID arrays
|
private boolean |
lenientOffEnd
false if running off end of results should raise error |
private static java.util.logging.Logger |
LOG
Logger
|
protected OffEnd |
offEnd
Has the query run off either end of its result set?
|
private Persistence |
persistence
Persistence object which this query's components use
|
private boolean |
regCleaner
Has query been registered for resource cleanup?
|
private boolean |
regWithSession
Is query registered for session event notification?
|
private RepositionCache |
repoCache
Cache of primary key lists to result set row numbers
|
private boolean |
resolvableArgs
Does this query have any arguments which are runtime resolvable?
|
private Results |
results
Result set for this query
|
private int |
rowCount
Number of total results returned
|
private boolean |
scrolling
Flag indicating results must be scrollable
|
protected java.lang.String |
sort
HQL order by clause used across all query components
|
private java.util.List<java.util.function.Supplier<logical>> |
whereExprList
List of client-side where clause expressions
|
closed, inverseSorting, parameterFilter
CURRENT, FIRST, LAST, NEXT, NONE, PREVIOUS, RETRIEVE_MODES, UNIQUE
Constructor and Description |
---|
PreselectQuery()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
_isOffEnd()
Indicate whether the query has run off either end of its result set,
due to scrolling beyond the last record or before the first record.
|
void |
addComponent(DataModelObject dmo,
java.lang.String where)
Add a component to the query.
|
void |
addComponent(DataModelObject dmo,
java.lang.String where,
DataModelObject inverse)
Add a component to the query.
|
void |
addComponent(DataModelObject dmo,
java.lang.String where,
DataModelObject inverse,
LockType lockType)
Add a component to the query.
|
void |
addComponent(DataModelObject dmo,
java.lang.String where,
DataModelObject inverse,
java.lang.Object[] args)
Add a component to the query.
|
void |
addComponent(DataModelObject dmo,
java.lang.String where,
DataModelObject inverse,
java.lang.Object[] args,
LockType lockType)
Add a component to the query.
|
void |
addComponent(DataModelObject dmo,
java.lang.String where,
DataModelObject inverse,
java.lang.Object[] args,
LockType lockType,
int iteration,
boolean outer)
Add a component to the query.
|
void |
addComponent(DataModelObject dmo,
java.lang.String where,
LockType lockType)
Add a component to the query.
|
void |
addComponent(DataModelObject dmo,
java.lang.String where,
java.lang.Object[] args)
Add a component to the query.
|
void |
addComponent(DataModelObject dmo,
java.lang.String where,
java.lang.Object[] args,
LockType lockType)
Add a component to the query.
|
void |
addComponent(DataModelObject dmo,
java.lang.String where,
java.lang.Object[] args,
LockType lockType,
int iteration,
boolean outer)
Add a component to the query.
|
void |
addComponent(DataModelObject dmo,
java.lang.String where,
java.lang.String indexInfo)
Add a component to the query.
|
void |
addComponent(DataModelObject dmo,
java.lang.String where,
java.lang.String indexInfo,
DataModelObject inverse)
Add a component to the query.
|
void |
addComponent(DataModelObject dmo,
java.lang.String where,
java.lang.String indexInfo,
DataModelObject inverse,
LockType lockType)
Add a component to the query.
|
void |
addComponent(DataModelObject dmo,
java.lang.String where,
java.lang.String indexInfo,
DataModelObject inverse,
java.lang.Object[] args)
Add a component to the query.
|
void |
addComponent(DataModelObject dmo,
java.lang.String where,
java.lang.String indexInfo,
DataModelObject inverse,
java.lang.Object[] args,
LockType lockType)
Add a component to the query.
|
void |
addComponent(DataModelObject dmo,
java.lang.String where,
java.lang.String indexInfo,
DataModelObject inverse,
java.lang.Object[] args,
LockType lockType,
int iteration,
boolean outer)
Add a component to the query.
|
void |
addComponent(DataModelObject dmo,
java.lang.String where,
java.lang.String indexInfo,
LockType lockType)
Add a component to the query.
|
void |
addComponent(DataModelObject dmo,
java.lang.String where,
java.lang.String indexInfo,
java.lang.Object[] args)
Add a component to the query.
|
void |
addComponent(DataModelObject dmo,
java.lang.String where,
java.lang.String indexInfo,
java.lang.Object[] args,
LockType lockType)
Add a component to the query.
|
void |
addComponent(DataModelObject dmo,
java.lang.String where,
java.lang.String indexInfo,
java.lang.Object[] args,
LockType lockType,
int iteration,
boolean outer)
Add a component to the query.
|
protected void |
addComponent(QueryComponent comp)
Add a component to the query.
|
void |
addWhereExpression(java.util.function.Supplier<logical> whereExpr)
Add a client-side where expression to this query.
|
protected void |
assembleFromClause(java.lang.StringBuilder buf,
java.util.List<SortCriterion> sortCriteria)
Assemble the from clause for an HQL query.
|
private java.lang.String |
assembleHQL()
Assemble the HQL which is submitted to Hibernate in order to execute
the database query underlying this object.
|
protected java.util.List<SortCriterion> |
assembleOrderByClause(java.lang.StringBuilder buf)
Assemble the
order by clause for an HQL query. |
protected java.util.List<SortCriterion> |
assembleOrderByClauseNoPreamble(java.lang.StringBuilder buf,
java.util.List<SortCriterion> sortCriteria)
Assemble the
order by clause for an HQL query, sans the
"order by" preamble. |
protected java.util.List<SortCriterion> |
assembleOrderByClauseNoPreamble(java.lang.StringBuilder buf,
java.lang.String sort)
Assemble the
order by clause for an HQL query, sans the
"order by" preamble. |
protected void |
assembleSelectClause(java.lang.StringBuilder buf)
Assemble the select clause for an HQL projection query, where the only
field retrieved for each buffer is the primary key.
|
protected HQLExpression |
assembleWhereClause(java.util.List<SortCriterion> sortCriteria)
Assemble the restriction (i.e., where) clause for an HQL query.
|
boolean |
backward(int rows)
Move the current cursor position backward by the specified number of rows.
|
boolean |
backward(NumberType rows)
Move the current cursor position backward by the specified number of rows.
|
protected java.util.List<SortCriterion> |
buildSortCriteria(java.lang.String sort)
Returns a list
SortCriterion objects build from the given
sort clause. |
protected SimpleResults |
cacheResults(Results target)
Attempt to cache all results from the specified target result set into
a
SimpleResults instance. |
void |
cleanup()
Clean up query resources when this query's scope ends.
|
protected void |
clearRepoCache()
Clear the reposition cache of visited, virtual composite rows.
|
protected java.util.Iterator<QueryComponent> |
components()
Get an iterator on the query components.
|
protected void |
coreFetch(java.lang.Object[] data,
LockType lockType,
boolean errorIfNull,
boolean silentIfNullId)
Fetch all records for a given result row into their backing buffers,
given an array of data which contains one primary key or DMO per query
component.
|
protected Results |
createResults(Results results)
Optionally wrapper the result set created for the query with a filtering
Results implementation (for client-side where processing). |
void |
current()
Reload the current composite row of results for the query.
|
void |
current(LockType lockType)
Reload the current composite row of results for the query, overriding
the lock type to apply to each record.
|
integer |
currentRow()
Progress-compatible function that returns the 1-based index of the
current row in the result set.
|
integer |
currentRowImpl()
Get the 1-based index of the current row in the result set.
|
void |
deleted()
Provides a notification that the external program scope in which the object is registered is
is being deleted and the object's reference will be lost after this method is called.
|
logical |
deleteResultListEntry(boolean allowBetweenRows)
Deletes the current row of a query's result list.
|
void |
deregisteredSessionListener()
Invoked when this session listener is removed from the list of
registered session listeners.
|
protected boolean |
execute()
Compose an HQL query statement to represent the combination of all query
components, execute it, and store the scrollable results.
|
protected Results |
executeQuery(Persistence persistence,
java.lang.String hql,
java.lang.Object[] args,
org.hibernate.type.Type[] types)
Execute the query to create a first level result set.
|
protected org.hibernate.ScrollableResults |
executeScroll(Persistence persistence,
java.lang.String hql,
java.lang.Object[] args,
org.hibernate.type.Type[] types)
Execute the query to create a
ScrollableResults result set. |
protected void |
fetch(boolean available,
LockType lockType,
boolean errorIfNull)
Fetch all records for a given result row into their backing buffers.
|
private QueryComponent |
findComponent(RecordBuffer buffer)
Find the query component associated with the given record buffer.
|
void |
finished()
Provides a notification that the scope in which this query was created
is ending.
|
void |
first()
Retrieve the first composite row of results for the query.
|
void |
first(LockType lockType)
Retrieve the first composite row of results for the query.
|
void |
forceDynamicOperation()
Force this query to operate in dynamic retrieval mode, if it supports this mode.
|
boolean |
forward(int rows)
Advance the current cursor position forward by the specified number of rows.
|
boolean |
forward(NumberType rows)
Advance the current cursor position forward by the specified number of rows.
|
java.lang.Object[] |
getArgs()
Get the query substitution arguments associated with this query, if any.
|
protected java.lang.String[] |
getEntities()
Collect the names of the entities (DMO types) associated with this query.
|
protected java.lang.String |
getHQL()
Get the HQL query which was executed to produce this query's results.
|
AbstractJoin |
getJoin()
Get the legacy natural join, if any, associated with this query.
|
OffEnd |
getOffEnd()
Get the off-end status of this query, which indicates whether the query
has run off either end of its results.
|
java.util.List<QueryOffEndListener> |
getOffEndListeners()
Get all the off-end listeners associated with this query.
|
java.lang.String |
getOriginalWhere()
Get the original, HQL where clause associated with this query.
|
protected Persistence |
getPersistence()
Get the persistence service object used by this query.
|
RecordBuffer[] |
getRecordBuffers()
Access the record buffers manipulated by this query, in order from
left-most (outermost) table of the query's join (if any) to right-most
(innermost) table.
|
protected Results |
getResults()
Access the current
Results object for this query. |
java.lang.Object[] |
getRow()
Assemble an array of primary key IDs for the current record(s) in the
buffers underlying this query, from left-most to right-most (in the
sense of how the query joins the associated tables).
|
java.lang.String |
getSortPhrase()
Get the sort phrase associated with this query.
|
int |
getTableCount()
Get the number of tables joined by this query.
|
protected java.io.Serializable |
getTemplateQueryRowid(java.lang.Object[] args)
Checks if this is a template query.
|
protected java.util.List<java.util.function.Supplier<logical>> |
getWhereExpressions()
Get this query's client-side where expressions.
|
protected void |
handleMissingJoinRecord()
Respond to the condition that a component with a non-null JOIN has a
missing inverse on which to perform the join.
|
boolean |
hasWhereExpression()
Indicate whether this query has a client-side where clause expression associated with it.
|
character |
indexInformation(NumberType n)
Conversion of INDEX-INFORMATION attribute (KW_IDX_INFO).
|
PreselectQuery |
initialize(boolean lenientOffEnd,
java.lang.String sort)
Initializer logic which is typically used for a multi-table query.
|
PreselectQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort)
Initializer logic designed for a single-table preselect query.
|
PreselectQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
DataModelObject inverse)
Initializer logic designed for a single-table preselect query.
|
PreselectQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
DataModelObject inverse,
LockType lockType)
Initializer logic designed for a single-table preselect query.
|
PreselectQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
DataModelObject inverse,
java.lang.Object[] args)
Initializer logic designed for a single-table preselect query.
|
PreselectQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
DataModelObject inverse,
java.lang.Object[] args,
LockType lockType)
Initializer logic designed for a single-table preselect query.
|
PreselectQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
LockType lockType)
Initializer logic designed for a single-table preselect query.
|
PreselectQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
java.lang.Object[] args)
Initializer logic designed for a single-table preselect query.
|
PreselectQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
java.lang.Object[] args,
LockType lockType)
Initializer logic designed for a single-table preselect query.
|
PreselectQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
java.lang.String indexInfo)
Initializer logic designed for a single-table preselect query.
|
PreselectQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
java.lang.String indexInfo,
DataModelObject inverse)
Initializer logic designed for a single-table preselect query.
|
PreselectQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
java.lang.String indexInfo,
DataModelObject inverse,
LockType lockType)
Initializer logic designed for a single-table preselect query.
|
PreselectQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
java.lang.String indexInfo,
DataModelObject inverse,
java.lang.Object[] args)
Initializer logic designed for a single-table preselect query.
|
PreselectQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
java.lang.String indexInfo,
DataModelObject inverse,
java.lang.Object[] args,
LockType lockType)
Initializer logic designed for a single-table preselect query.
|
PreselectQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
java.lang.String indexInfo,
LockType lockType)
Initializer logic designed for a single-table preselect query.
|
PreselectQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
java.lang.String indexInfo,
java.lang.Object[] args)
Initializer logic designed for a single-table preselect query.
|
PreselectQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
java.lang.String indexInfo,
java.lang.Object[] args,
LockType lockType)
Initializer logic designed for a single-table preselect query.
|
PreselectQuery |
initialize(java.lang.String sort)
Initializer logic which is typically used for a multi-table query.
|
protected boolean |
isClientWhere()
Indicate whether this query requires initial results to be filtered
through a client-side where clause expression.
|
boolean |
isFullRecords()
Indicate whether the query will retrieve full records, rather than primary keys only.
|
protected boolean |
isLenientOffEnd()
Indicate whether this query will throw a
QueryOffEndException when it runs off the end of its
results. |
boolean |
isNativelyPreselect()
Indicate whether this query is a preselect query by its nature.
|
protected boolean |
isNativelyScrolling()
Indicate whether this query type is scrolling by its nature.
|
logical |
isOffEnd()
Indicate whether the query has run off either end of its result set,
due to scrolling beyond the last record or before the first record.
|
boolean |
isPreselect()
Indicate whether this query preselects all of its results.
|
boolean |
isScrolling()
Indicate whether this query's
scrolling flag has been set. |
protected boolean |
isTopLevelCleanup()
Indicate whether results resources should be cleaned up upon exiting
the global scope or upon exiting the nearest enclosing scope in which
the results were created.
|
void |
iterate()
Provides a notification that the block whose scope in which the object
is registered is about to iterate and attempt another pass.
|
void |
last()
Retrieve the last composite row of results for the query.
|
void |
last(LockType lockType)
Retrieve the last composite row of results for the query.
|
void |
load(java.lang.Object[] data,
LockType lockType,
boolean silentIfNullId)
Load one or more records into their associated buffers, given an array
of primary key ID values, or the actual DMOs themselves.
|
AdaptiveComponent |
makeAdaptiveServerJoinComponent(java.util.List<AdaptiveComponent> joinList,
AdaptiveQuery query,
int iteration,
boolean outer,
CompoundComponent fallback)
Create an adaptive query component based on the information in this query (which is
presumed to be a single-table query), and given a list of adaptive query components which
represent outer, nested query loops, which will perform a server-side join to the
innermost, nested query component.
|
QueryComponent |
makePreselectServerJoinComponent(java.util.List<QueryComponent> joinList,
int iteration,
boolean outer)
Create a preselect query component based on the information in this query (which is
presumed to be a single-table query), and given a list of preselect query components which
represent outer, nested query loops, which will perform a server-side join to the
innermost, nested query component.
|
void |
next()
Retrieve the next composite row of results for the query.
|
void |
next(LockType lockType)
Retrieve the next composite row of results for the query.
|
void |
open()
Open the prepared query and reposition it to the first result if the
query is being browsed.
|
java.lang.Object[] |
peekFirst()
Fetch the array of primary key IDs associated with the first result in
this query's result list.
|
java.lang.Object[] |
peekLast()
Fetch the array of primary key IDs associated with the last result in
this query's result list.
|
java.lang.Object[] |
peekNext()
Fetch the array of primary key IDs associated with the next result in
this query's result list.
|
java.lang.Object[] |
peekPrevious()
Fetch the array of primary key IDs associated with the previous result
in this query's result list.
|
protected void |
prepareParameters(java.util.List<java.lang.Object> args,
java.util.List<org.hibernate.type.Type> types)
Prepare query substitution parameters for this query.
|
protected void |
prepareReposition()
Prepare to process a reposition request by releasing the current
records, if any, in each buffer managed by the query.
|
protected boolean |
preserveBuffersOnEmptyResults()
Indicate whether the record buffer(s) current record(s) should be preserved, in the event
the query does not find any results.
|
void |
previous()
Retrieve the previous composite row of results for the query.
|
void |
previous(LockType lockType)
Retrieve the previous composite row of results for the query.
|
protected AbstractJoin |
processJoin(BufferReference primary,
BufferReference inverse)
Given a primary DMO buffer and an inverse DMO buffer which together
define a natural join, create the
AbstractJoin helper
object which is used to implement the join. |
protected void |
registerCleaner()
Register a
Finalizable with the transaction manager for
resource cleanup when this query's scope ends. |
void |
registerRecordChangeListeners(int scope)
Register all
RecordChangeListener s associated with this
query (if any), with the context-local ChangeBroker at the
indicated scope. |
void |
reposition(int row)
Reposition the query to the specified row in the result set.
|
void |
reposition(NumberType row)
Reposition the cursor to the specified row in the result set.
|
void |
repositionByID(recid id)
Reposition the cursor such that a request to retrieve the next result
will retrieve the result which matches the specified primary key ID.
|
void |
repositionByID(rowid id1,
rowid... joinIDs)
Reposition the cursor such that a request to retrieve the next result
will retrieve the result which matches the specified array of primary
key IDs.
|
protected boolean |
repositionByID(java.io.Serializable[] ids,
boolean forceFetch)
Reposition the cursor such that a request to retrieve the next result
will retrieve the result which matches the specified array of primary
key IDs.
|
void |
reset(boolean resolveArgs)
Reset the query by clearing its state to a known default.
|
protected void |
resetResults()
Discard the current result set, clear the reposition cache, and reset
result-related state to default values.
|
void |
retry()
Provides a notification that the block whose scope in which the object
is registered is about to retry the same iteration (all loop control
data is unchanged).
|
boolean |
sessionEvent(SessionListener.Event event)
Respond to a clean (i.e., transaction commit) session event by caching
all preselected results and using that cache to back the query's results
for all future fetches.
|
protected void |
setEmptyBuffersUnknown()
Walk through each component and set its backing buffer to unknown mode,
such that the invocation of any of its DMO-backed methods returns
unknown value.
|
void |
setFullRecords()
Force the query to retrieve full records, rather than primary keys only.
|
void |
setIterationType(int iteration)
Set the iteration type for the most recently added query component.
|
void |
setIterationType(int iteration,
java.lang.String sort)
Set the iteration type for the most recently added query component.
|
void |
setLenientOffEnd(boolean lenientOffEnd)
Set the behavior of this query as a record retrieval request moves off
the end of its results.
|
void |
setNonScrolling()
Disable results list scrolling/repositioning (if it was enabled by
default).
|
void |
setResults(Results results)
Set the given results object into this query.
|
void |
setScrolling()
Override parent's no-op implementation to track whether client code has
set this as a scrollable query.
|
void |
setUnknownRecord()
Set each buffer backing a query component to unknown mode.
|
integer |
size()
Return the number of results found for this query.
|
protected boolean |
supportsArbitraryIteration()
Does this query support non-NEXT iteration components?
|
java.lang.String |
toString()
Create a string representation of this object's state, primarily for debug purposes.
|
protected boolean |
treatPreviousAsLast()
Indicate whether a call to move to the previous record in the result
list should be treated as a call to move to the last record in the list.
|
void |
unique()
Retrieve a unique record (only valid for a single-table query).
|
void |
unique(LockType lockType)
Retrieve a unique record (only valid for a single-table query),
overriding the default lock type of the underlying query component.
|
private boolean |
validateReposition(NumberType value)
Validate a numeric value provided to a reposition request to ensure
that it does not represent the unknown value.
|
private boolean |
validateRepositionByID(recid value)
Validate a record identifier provided to a reposition request to ensure
that it does not represent the unknown value.
|
private boolean |
validateRepositionByID(rowid value)
Validate a row identifier provided to a reposition request to ensure
that it does not represent the unknown value.
|
private boolean |
validateRepositionImpl(BaseDataType value,
int errorNum,
java.lang.String errorMsg)
Validate a numeric value provided to a reposition request to ensure
that it does not represent the unknown value.
|
protected boolean |
verifyJoins()
Invoked just before query execution, this method checks whether all
components with a non-null JOIN have a valid inverse on which to perform
the join.
|
protected java.util.Iterator<java.util.function.Supplier<logical>> |
whereExpressions()
Get an iterator on this query's client-side where expressions.
|
accumulate, addAccumulator, addAccumulator, addBuffer, addBuffer, addRepositionListener, afterReposition, bufferHandle, bufferHandle, bufferHandle, bufferHandle, bufferHandle, changeForwardOnly, changeForwardOnly, close, deleteResultListEntry, exclude, forwardOnly, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getFirst, getFirst, getFirst, getFirst, getFirst, getFirst, getFirst, getFirst, getLast, getLast, getLast, getLast, getLast, getLast, getLast, getLast, getNext, getNext, getNext, getNext, getNext, getNext, getNext, getNext, getNumResults, getPrevious, getPrevious, getPrevious, getPrevious, getPrevious, getPrevious, getPrevious, getPrevious, getReferencedBuffers, hasAccumulators, hasAny, hasAny, hasAny, hasAny, hasOne, hasOne, hasOne, hasOne, include, indexInformation, indexInformation, isBrowsed, isErrorIfNull, isFetchOnReposition, isLastOfBreakGroup, isNewBreakGroup, isOpen, isRepositionNotificationActive, isSkipDeletedRecord, isStandalone, loadRowAtCursor, notifyRepositionListeners, numBuffers, numResults, numResults, optimize, prepare, prepare, prepareFetch, prepareString, preprocessSubstitutionArguments, queryBackward, queryBackward, queryClose, queryForward, queryForward, queryOpen, queryReposition, queryReposition, queryRepositionByID, releaseBuffers, removeRepositionListener, setBrowsed, setBuffers, setBuffers, setErrorIfNull, setExternalBuffers, setFetchOnReposition, setParameterFilter, setSkipDeletedRecord, setStandalone, validateSubstitutionArguments
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getReferencedBuffers, setErrorIfNull
addAccumulator, addAccumulator, addBuffer, addBuffer, addRepositionListener, bufferHandle, bufferHandle, bufferHandle, bufferHandle, bufferHandle, changeForwardOnly, changeForwardOnly, close, close, deleteResultListEntry, exclude, forwardOnly, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getCurrent, getFirst, getFirst, getFirst, getFirst, getFirst, getFirst, getFirst, getFirst, getLast, getLast, getLast, getLast, getLast, getLast, getLast, getLast, getNext, getNext, getNext, getNext, getNext, getNext, getNext, getNext, getNumResults, getPrevious, getPrevious, getPrevious, getPrevious, getPrevious, getPrevious, getPrevious, getPrevious, hasAny, hasAny, hasAny, hasAny, hasOne, hasOne, hasOne, hasOne, include, indexInformation, indexInformation, isBrowsed, isFetchOnReposition, isOpen, isSkipDeletedRecord, isStandalone, notifyRepositionListeners, numBuffers, optimize, prepare, prepare, prepareString, queryBackward, queryBackward, queryClose, queryForward, queryForward, queryOpen, queryReposition, queryReposition, queryRepositionByID, removeRepositionListener, setBrowsed, setBuffers, setBuffers, setExternalBuffers, setFetchOnReposition, setParameterFilter, setSkipDeletedRecord, setStandalone
initFailure
private static final java.util.logging.Logger LOG
protected boolean betweenRows
protected OffEnd offEnd
protected java.lang.String sort
protected java.util.List<QueryComponent> components
protected boolean currentRowDeleted
private java.util.List<java.util.function.Supplier<logical>> whereExprList
private Persistence persistence
private boolean scrolling
private RepositionCache repoCache
private java.lang.String hql
private Results results
private boolean resolvableArgs
private boolean lenientOffEnd
false
if running off end of results should raise errorprivate int rowCount
private boolean regWithSession
private boolean regCleaner
private boolean fullRecords
public PreselectQuery()
initialize()
is
called.public PreselectQuery initialize(java.lang.String sort)
addComponent
method variants.
This code is intentionally separated from the constructor. The purpose of this separation is to allow construction to occur in the prior scope while initialization can still occur within a method or lambda that is inside the next block's scope.
sort
- HQL order by clause to be applied across all components of the
query.public PreselectQuery initialize(boolean lenientOffEnd, java.lang.String sort)
addComponent
method variants.
This variant is used by code which is converted from an OPEN QUERY
statement, which permits advancing off the end of a result set without
raising a QueryOffEndException
.
This code is intentionally separated from the constructor. The purpose of this separation is to allow construction to occur in the prior scope while initialization can still occur within a method or lambda that is inside the next block's scope.
lenientOffEnd
- true
if advancing past either end of the result
set should NOT raise a QueryOffEndException
;
false
if doing so should raise the exception.sort
- HQL order by clause to be applied across all components of the
query.public PreselectQuery initialize(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, java.lang.String sort)
This code is intentionally separated from the constructor. The purpose of this separation is to allow construction to occur in the prior scope while initialization can still occur within a method or lambda that is inside the next block's scope.
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.whereExpr
- Client-side where clause expression. May be null
.sort
- HQL order by clause.public PreselectQuery initialize(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, java.lang.String sort, java.lang.String indexInfo)
This code is intentionally separated from the constructor. The purpose of this separation is to allow construction to occur in the prior scope while initialization can still occur within a method or lambda that is inside the next block's scope.
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.whereExpr
- Client-side where clause expression. May be null
.sort
- HQL order by clause.indexInfo
- Index information string as it is returned by INDEX-INFORMATION.
May be null
if it is not an OPEN QUERY case or if
you don't need debug information about selected indexes.public PreselectQuery initialize(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, java.lang.String sort, DataModelObject inverse)
This code is intentionally separated from the constructor. The purpose of this separation is to allow construction to occur in the prior scope while initialization can still occur within a method or lambda that is inside the next block's scope.
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.whereExpr
- Client-side where clause expression. May be null
.sort
- HQL order by clause.inverse
- DMO to which this query should join via a foreign relation.
May be null
.public PreselectQuery initialize(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, java.lang.String sort, java.lang.String indexInfo, DataModelObject inverse)
This code is intentionally separated from the constructor. The purpose of this separation is to allow construction to occur in the prior scope while initialization can still occur within a method or lambda that is inside the next block's scope.
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.whereExpr
- Client-side where clause expression. May be null
.sort
- HQL order by clause.indexInfo
- Index information string as it is returned by INDEX-INFORMATION.
May be null
if it is not an OPEN QUERY case or if
you don't need debug information about selected indexes.inverse
- DMO to which this query should join via a foreign relation.
May be null
.public PreselectQuery initialize(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, java.lang.String sort, java.lang.Object[] args)
This code is intentionally separated from the constructor. The purpose of this separation is to allow construction to occur in the prior scope while initialization can still occur within a method or lambda that is inside the next block's scope.
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.whereExpr
- Client-side where clause expression. May be null
.sort
- HQL order by clause.args
- Substitution parameters to be inserted into placeholders within
the where clause.public PreselectQuery initialize(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, java.lang.String sort, java.lang.String indexInfo, java.lang.Object[] args)
This code is intentionally separated from the constructor. The purpose of this separation is to allow construction to occur in the prior scope while initialization can still occur within a method or lambda that is inside the next block's scope.
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.whereExpr
- Client-side where clause expression. May be null
.sort
- HQL order by clause.indexInfo
- Index information string as it is returned by INDEX-INFORMATION.
May be null
if it is not an OPEN QUERY case or if
you don't need debug information about selected indexes.args
- Substitution parameters to be inserted into placeholders within
the where clause.public PreselectQuery initialize(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, java.lang.String sort, DataModelObject inverse, java.lang.Object[] args)
This code is intentionally separated from the constructor. The purpose of this separation is to allow construction to occur in the prior scope while initialization can still occur within a method or lambda that is inside the next block's scope.
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.whereExpr
- Client-side where clause expression. May be null
.sort
- HQL order by clause.inverse
- DMO to which this query should join via a foreign relation.
May be null
.args
- Substitution parameters to be inserted into placeholders within
the where clause.public PreselectQuery initialize(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, java.lang.String sort, java.lang.String indexInfo, DataModelObject inverse, java.lang.Object[] args)
This code is intentionally separated from the constructor. The purpose of this separation is to allow construction to occur in the prior scope while initialization can still occur within a method or lambda that is inside the next block's scope.
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.whereExpr
- Client-side where clause expression. May be null
.sort
- HQL order by clause.indexInfo
- Index information string as it is returned by INDEX-INFORMATION.
May be null
if it is not an OPEN QUERY case or if
you don't need debug information about selected indexes.inverse
- DMO to which this query should join via a foreign relation.
May be null
.args
- Substitution parameters to be inserted into placeholders within
the where clause.public PreselectQuery initialize(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, java.lang.String sort, LockType lockType)
This code is intentionally separated from the constructor. The purpose of this separation is to allow construction to occur in the prior scope while initialization can still occur within a method or lambda that is inside the next block's scope.
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.whereExpr
- Client-side where clause expression. May be null
.sort
- HQL order by clause.lockType
- Lock type to apply to records retrieved by this query.public PreselectQuery initialize(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, java.lang.String sort, java.lang.String indexInfo, LockType lockType)
This code is intentionally separated from the constructor. The purpose of this separation is to allow construction to occur in the prior scope while initialization can still occur within a method or lambda that is inside the next block's scope.
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.whereExpr
- Client-side where clause expression. May be null
.sort
- HQL order by clause.indexInfo
- Index information string as it is returned by INDEX-INFORMATION.
May be null
if it is not an OPEN QUERY case or if
you don't need debug information about selected indexes.lockType
- Lock type to apply to records retrieved by this query.public PreselectQuery initialize(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, java.lang.String sort, DataModelObject inverse, LockType lockType)
This code is intentionally separated from the constructor. The purpose of this separation is to allow construction to occur in the prior scope while initialization can still occur within a method or lambda that is inside the next block's scope.
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.whereExpr
- Client-side where clause expression. May be null
.sort
- HQL order by clause.inverse
- DMO to which this query should join via a foreign relation.
May be null
.lockType
- Lock type to apply to records retrieved by this query.public PreselectQuery initialize(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, java.lang.String sort, java.lang.String indexInfo, DataModelObject inverse, LockType lockType)
This code is intentionally separated from the constructor. The purpose of this separation is to allow construction to occur in the prior scope while initialization can still occur within a method or lambda that is inside the next block's scope.
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.whereExpr
- Client-side where clause expression. May be null
.sort
- HQL order by clause.indexInfo
- Index information string as it is returned by INDEX-INFORMATION.
May be null
if it is not an OPEN QUERY case or if
you don't need debug information about selected indexes.inverse
- DMO to which this query should join via a foreign relation.
May be null
.lockType
- Lock type to apply to records retrieved by this query.public PreselectQuery initialize(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, java.lang.String sort, java.lang.Object[] args, LockType lockType)
This code is intentionally separated from the constructor. The purpose of this separation is to allow construction to occur in the prior scope while initialization can still occur within a method or lambda that is inside the next block's scope.
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.whereExpr
- Client-side where clause expression. May be null
.sort
- HQL order by clause.args
- Substitution parameters to be inserted into placeholders within
the where clause.lockType
- Lock type to apply to records retrieved by this query.public PreselectQuery initialize(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, java.lang.String sort, java.lang.String indexInfo, java.lang.Object[] args, LockType lockType)
This code is intentionally separated from the constructor. The purpose of this separation is to allow construction to occur in the prior scope while initialization can still occur within a method or lambda that is inside the next block's scope.
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.whereExpr
- Client-side where clause expression. May be null
.sort
- HQL order by clause.indexInfo
- Index information string as it is returned by INDEX-INFORMATION.
May be null
if it is not an OPEN QUERY case or if
you don't need debug information about selected indexes.args
- Substitution parameters to be inserted into placeholders within
the where clause.lockType
- Lock type to apply to records retrieved by this query.public PreselectQuery initialize(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, java.lang.String sort, DataModelObject inverse, java.lang.Object[] args, LockType lockType)
This code is intentionally separated from the constructor. The purpose of this separation is to allow construction to occur in the prior scope while initialization can still occur within a method or lambda that is inside the next block's scope.
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.whereExpr
- Client-side where clause expression. May be null
.sort
- HQL order by clause.inverse
- DMO to which this query should join via a foreign relation.
May be null
.args
- Substitution parameters to be inserted into placeholders within
the where clause.lockType
- Lock type to apply to records retrieved by this query.public PreselectQuery initialize(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, java.lang.String sort, java.lang.String indexInfo, DataModelObject inverse, java.lang.Object[] args, LockType lockType)
This code is intentionally separated from the constructor. The purpose of this separation is to allow construction to occur in the prior scope while initialization can still occur within a method or lambda that is inside the next block's scope.
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.whereExpr
- Client-side where clause expression. May be null
.sort
- HQL order by clause.indexInfo
- Index information string as it is returned by INDEX-INFORMATION.
May be null
if it is not an OPEN QUERY case or if
you don't need debug information about selected indexes.inverse
- DMO to which this query should join via a foreign relation.
May be null
.args
- Substitution parameters to be inserted into placeholders within
the where clause.lockType
- Lock type to apply to records retrieved by this query.public void setLenientOffEnd(boolean lenientOffEnd)
next
and previous
which do not find a record
do not raise a QueryOffEndException
. By default, this
would normally raise the exception.lenientOffEnd
- true
to suppress QueryOffEndException
for next
and previous
requests;
false
to permit these exceptions.public void addComponent(DataModelObject dmo, java.lang.String where)
NEXT
iteration type
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.public void addComponent(DataModelObject dmo, java.lang.String where, java.lang.String indexInfo)
NEXT
iteration type
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.indexInfo
- Index information string as it is returned by INDEX-INFORMATION.
May be null
if it is not an OPEN QUERY case or if
you don't need debug information about selected indexes.public void addComponent(DataModelObject dmo, java.lang.String where, DataModelObject inverse)
NEXT
iteration type
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.inverse
- DMO to which this query should join via a foreign relation.
May be null
.public void addComponent(DataModelObject dmo, java.lang.String where, java.lang.String indexInfo, DataModelObject inverse)
NEXT
iteration type
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.indexInfo
- Index information string as it is returned by INDEX-INFORMATION.
May be null
if it is not an OPEN QUERY case or if
you don't need debug information about selected indexes.inverse
- DMO to which this query should join via a foreign relation.
May be null
.public void addComponent(DataModelObject dmo, java.lang.String where, java.lang.Object[] args)
NEXT
iteration type
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.args
- Substitution parameters to be inserted into placeholders within
the where clause.public void addComponent(DataModelObject dmo, java.lang.String where, java.lang.String indexInfo, java.lang.Object[] args)
NEXT
iteration type
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.indexInfo
- Index information string as it is returned by INDEX-INFORMATION.
May be null
if it is not an OPEN QUERY case or if
you don't need debug information about selected indexes.args
- Substitution parameters to be inserted into placeholders within
the where clause.public void addComponent(DataModelObject dmo, java.lang.String where, DataModelObject inverse, java.lang.Object[] args)
NEXT
iteration type
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.inverse
- DMO to which this query should join via a foreign relation.
May be null
.args
- Substitution parameters to be inserted into placeholders within
the where clause.public void addComponent(DataModelObject dmo, java.lang.String where, java.lang.String indexInfo, DataModelObject inverse, java.lang.Object[] args)
NEXT
iteration type
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.indexInfo
- Index information string as it is returned by INDEX-INFORMATION.
May be null
if it is not an OPEN QUERY case or if
you don't need debug information about selected indexes.inverse
- DMO to which this query should join via a foreign relation.
May be null
.args
- Substitution parameters to be inserted into placeholders within
the where clause.public void addComponent(DataModelObject dmo, java.lang.String where, LockType lockType)
NEXT
iteration type
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.lockType
- Lock type to apply to records retrieved by this component of
the query.public void addComponent(DataModelObject dmo, java.lang.String where, java.lang.String indexInfo, LockType lockType)
NEXT
iteration type
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.indexInfo
- Index information string as it is returned by INDEX-INFORMATION.
May be null
if it is not an OPEN QUERY case or if
you don't need debug information about selected indexes.lockType
- Lock type to apply to records retrieved by this component of
the query.public void addComponent(DataModelObject dmo, java.lang.String where, DataModelObject inverse, LockType lockType)
NEXT
iteration type
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.inverse
- DMO to which this query should join via a foreign relation.
May be null
.lockType
- Lock type to apply to records retrieved by this component of
the query.public void addComponent(DataModelObject dmo, java.lang.String where, java.lang.String indexInfo, DataModelObject inverse, LockType lockType)
NEXT
iteration type
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.indexInfo
- Index information string as it is returned by INDEX-INFORMATION.
May be null
if it is not an OPEN QUERY case or if
you don't need debug information about selected indexes.inverse
- DMO to which this query should join via a foreign relation.
May be null
.lockType
- Lock type to apply to records retrieved by this component of
the query.public void addComponent(DataModelObject dmo, java.lang.String where, java.lang.Object[] args, LockType lockType)
NEXT
iteration type
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.args
- Substitution parameters to be inserted into placeholders within
the where clause.lockType
- Lock type to apply to records retrieved by this component of
the query.public void addComponent(DataModelObject dmo, java.lang.String where, java.lang.String indexInfo, java.lang.Object[] args, LockType lockType)
NEXT
iteration type
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.indexInfo
- Index information string as it is returned by INDEX-INFORMATION.
May be null
if it is not an OPEN QUERY case or if
you don't need debug information about selected indexes.args
- Substitution parameters to be inserted into placeholders within
the where clause.lockType
- Lock type to apply to records retrieved by this component of
the query.public void addComponent(DataModelObject dmo, java.lang.String where, DataModelObject inverse, java.lang.Object[] args, LockType lockType)
NEXT
iteration type
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.inverse
- DMO to which this query should join via a foreign relation.
May be null
.args
- Substitution parameters to be inserted into placeholders within
the where clause.lockType
- Lock type to apply to records retrieved by this component of
the query.public void addComponent(DataModelObject dmo, java.lang.String where, java.lang.String indexInfo, DataModelObject inverse, java.lang.Object[] args, LockType lockType)
NEXT
iteration type
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.indexInfo
- Index information string as it is returned by INDEX-INFORMATION.
May be null
if it is not an OPEN QUERY case or if
you don't need debug information about selected indexes.inverse
- DMO to which this query should join via a foreign relation.
May be null
.args
- Substitution parameters to be inserted into placeholders within
the where clause.lockType
- Lock type to apply to records retrieved by this component of
the query.public void addComponent(DataModelObject dmo, java.lang.String where, java.lang.Object[] args, LockType lockType, int iteration, boolean outer)
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.args
- Substitution parameters to be inserted into placeholders within
the where clause.lockType
- Lock type to apply to records retrieved by this component of
the query.iteration
- Iteration/retrieval mode for this component of the query. At
this time, only NEXT
is supported. Future
support for FIRST
, LAST
, and
UNIQUE
is expected.outer
- true
if an outer join is required. At this time,
only inner joins are supported. Future support for outer
joins is expected.java.lang.UnsupportedOperationException
- if outer
is true
(temporary);
if iteration
is not NEXT
(temporary);
if dmo
's associated database is different than
that of a previously added component's database (cross-database
preselect joins are not possible).public void addComponent(DataModelObject dmo, java.lang.String where, java.lang.String indexInfo, java.lang.Object[] args, LockType lockType, int iteration, boolean outer)
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.indexInfo
- Index information string as it is returned by INDEX-INFORMATION.
May be null
if it is not an OPEN QUERY case or if
you don't need debug information about selected indexes.args
- Substitution parameters to be inserted into placeholders within
the where clause.lockType
- Lock type to apply to records retrieved by this component of
the query.iteration
- Iteration/retrieval mode for this component of the query. At
this time, only NEXT
is supported. Future
support for FIRST
, LAST
, and
UNIQUE
is expected.outer
- true
if an outer join is required. At this time,
only inner joins are supported. Future support for outer
joins is expected.java.lang.UnsupportedOperationException
- if outer
is true
(temporary);
if iteration
is not NEXT
(temporary);
if dmo
's associated database is different than
that of a previously added component's database (cross-database
preselect joins are not possible).public void addComponent(DataModelObject dmo, java.lang.String where, DataModelObject inverse, java.lang.Object[] args, LockType lockType, int iteration, boolean outer)
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.inverse
- DMO to which this query should join via a foreign relation.
May be null
.args
- Substitution parameters to be inserted into placeholders within
the where clause.lockType
- Lock type to apply to records retrieved by this component of
the query.iteration
- Iteration/retrieval mode for this component of the query. At
this time, only NEXT
is supported. Future
support for FIRST
, LAST
, and
UNIQUE
is expected.outer
- true
if an outer join is required. At this time,
only inner joins are supported. Future support for outer
joins is expected.java.lang.UnsupportedOperationException
- if outer
is true
(temporary);
if iteration
is not NEXT
(temporary);
if dmo
's associated database is different than
that of a previously added component's database (cross-database
preselect joins are not possible).public void addComponent(DataModelObject dmo, java.lang.String where, java.lang.String indexInfo, DataModelObject inverse, java.lang.Object[] args, LockType lockType, int iteration, boolean outer)
dmo
- DMO proxy which defines buffer and record type.where
- HQL where clause. May be null
.indexInfo
- Index information string as it is returned by INDEX-INFORMATION.
May be null
if it is not an OPEN QUERY case or if
you don't need debug information about selected indexes.inverse
- DMO to which this query should join via a foreign relation.
May be null
.args
- Substitution parameters to be inserted into placeholders within
the where clause.lockType
- Lock type to apply to records retrieved by this component of
the query.iteration
- Iteration/retrieval mode for this component of the query. At
this time, only NEXT
is supported. Future
support for FIRST
, LAST
, and
UNIQUE
is expected.outer
- true
if an outer join is required. At this time,
only inner joins are supported. Future support for outer
joins is expected.java.lang.UnsupportedOperationException
- if outer
is true
(temporary);
if iteration
is not NEXT
(temporary);
if dmo
's associated database is different than
that of a previously added component's database (cross-database
preselect joins are not possible).public void registerRecordChangeListeners(int scope)
RecordChangeListener
s associated with this
query (if any), with the context-local ChangeBroker
at the
indicated scope.
This implementation does nothing.
registerRecordChangeListeners
in interface Joinable
scope
- Scope at which listeners should be registered with the change
broker.public boolean sessionEvent(SessionListener.Event event) throws PersistenceException
Respond to a session closing event by clearing all results, unless they were just cached as described above.
sessionEvent
in interface SessionListener
event
- Session event type.true
, indicating this query should be
deregistered as a session listener after this method returns;
else false
.PersistenceException
- if there is an error caching results.public void deregisteredSessionListener()
deregisteredSessionListener
in interface SessionListener
public void finished()
finished
in interface Finalizable
public void deleted()
This is a no-op implementation required by the interface.
deleted
in interface Finalizable
public void iterate()
iterate
in interface Finalizable
public void retry()
next()
at the top of the block body from
advancing to the next row.
This implementation retries the current record only if the query is
associated with a FOR block (see BlockType
).
retry
in interface Finalizable
public java.lang.String toString()
toString
in class java.lang.Object
public void addWhereExpression(java.util.function.Supplier<logical> whereExpr)
whereExpr
- Client-side where clause expression. May not be
null
.java.lang.NullPointerException
- if whereExpr
is null
.public void setIterationType(int iteration)
iteration
- Retrieval mode from QueryConstants
. Must not be FIRST or LAST (use
setIterationType(int, String)
instead for these types.java.lang.IllegalStateException
- If no component has yet been added.java.lang.IllegalArgumentException
- If iteration
type is FIRST
or LAST
.public void setIterationType(int iteration, java.lang.String sort)
iteration
- Retrieval mode from QueryConstants
.sort
- Order by clause which should be associated with the most recently added query
component. Must be non-null
for iteration types FIRST
and LAST
.java.lang.IllegalStateException
- If no component has yet been added.java.lang.IllegalArgumentException
- If iteration
type is FIRST
or LAST
, but
sort
is null
, or if sort
represents an
invalid HQL order by expression.public void first()
If the query involves outer joins, some of the underlying buffers may be empty when this method returns.
first
in interface P2JQuery
ErrorConditionException
- if the query or the fetch of any record fails, or if no records
are available and the query is set to fail in this case.QueryOffEndException
- if no records are available and the query is set not to fail
in this case.java.lang.IllegalStateException
- if no query component has been added to this query.public void first(LockType lockType)
If the query involves outer joins, some of the underlying buffers may be empty when this method returns.
first
in interface P2JQuery
lockType
- Lock type to apply to records retrieved (overrides default
lock type set for each query component).ErrorConditionException
- if the query or the fetch of any record fails, or if no records
are available and the query is set to fail in this case.QueryOffEndException
- if no records are available and the query is set not to fail
in this case.java.lang.IllegalStateException
- if no query component has been added to this query.public void last()
If the query involves outer joins, some of the underlying buffers may be empty when this method returns.
last
in interface P2JQuery
ErrorConditionException
- if the query or the fetch of any record fails, or if no records
are available and the query is set to fail in this case.QueryOffEndException
- if no records are available and the query is set not to fail
in this case.java.lang.IllegalStateException
- if no query component has been added to this query.public void last(LockType lockType)
If the query involves outer joins, some of the underlying buffers may be empty when this method returns.
last
in interface P2JQuery
lockType
- Lock type to apply to records retrieved (overrides default
lock type set for each query component).ErrorConditionException
- if the query or the fetch of any record fails, or if no records
are available and the query is set to fail in this case.QueryOffEndException
- if no records are available and the query is set not to fail
in this case.java.lang.IllegalStateException
- if no query component has been added to this query.public void next()
If the query involves outer joins, some of the underlying buffers may be empty when this method returns.
next
in interface P2JQuery
ErrorConditionException
- if the query or the fetch of any record fails, or if no records
are available and the query is set to fail in this case.QueryOffEndException
- if no records are available and the query is set not to fail
in this case.java.lang.IllegalStateException
- if no query component has been added to this query.public void next(LockType lockType)
If the query involves outer joins, some of the underlying buffers may be empty when this method returns.
next
in interface P2JQuery
lockType
- Lock type to apply to records retrieved (overrides default
lock type set for each query component).ErrorConditionException
- if the query or the fetch of any record fails, or if no records
are available and the query is set to fail in this case.QueryOffEndException
- if no records are available and the query is set not to fail
in this case.java.lang.IllegalStateException
- if no query component has been added to this query.public void previous()
If the query involves outer joins, some of the underlying buffers may be empty when this method returns.
previous
in interface P2JQuery
ErrorConditionException
- if the query or the fetch of any record fails, or if no records
are available and the query is set to fail in this case.QueryOffEndException
- if no records are available and the query is set not to fail
in this case.java.lang.IllegalStateException
- if no query component has been added to this query.public void previous(LockType lockType)
If the query involves outer joins, some of the underlying buffers may be empty when this method returns.
previous
in interface P2JQuery
lockType
- Lock type to apply to records retrieved (overrides default
lock type set for each query component).ErrorConditionException
- if the query or the fetch of any record fails, or if no records
are available and the query is set to fail in this case.QueryOffEndException
- if no records are available and the query is set not to fail
in this case.java.lang.IllegalStateException
- if no query component has been added to this query.public void unique()
unique
in interface P2JQuery
ErrorConditionException
- if the query fails or if more than one result is found which
matches the query criteria.java.lang.UnsupportedOperationException
- if this method is invoked on a multi-table query.java.lang.IllegalStateException
- if no query component has been added to this query.public void unique(LockType lockType)
unique
in interface P2JQuery
lockType
- Lock type which should override that of the query component.ErrorConditionException
- if the query fails or if more than one result is found which
matches the query criteria.java.lang.UnsupportedOperationException
- if this method is invoked on a multi-table query.java.lang.IllegalStateException
- if no query component has been added to this query.public void current()
If the query involves outer joins, some of the underlying buffers may be empty when this method returns.
current
in interface P2JQuery
ErrorConditionException
- if the reload triggers an error.java.lang.IllegalStateException
- if no query component has been added to this query.public void current(LockType lockType)
If the query involves outer joins, some of the underlying buffers may be empty when this method returns.
current
in interface P2JQuery
lockType
- Lock type which should override that of any query component.ErrorConditionException
- if the reload triggers an error.java.lang.IllegalStateException
- if no query component has been added to this query.public void load(java.lang.Object[] data, LockType lockType, boolean silentIfNullId) throws PersistenceException
In the event an expected value cannot be loaded (e.g., the record has
been deleted or is otherwise no longer available), this method throws
MissingRecordException
, after setting the associated buffer(s)
into unknown mode
. Note that a
record being locked by another session does not constitute a "missing"
record. Note also that this exception is not thrown until all the
elements of data
have been processed to the extent
possible.
load
in interface Joinable
data
- Array of primary key IDs or DMOs, one per table involved in the
query.lockType
- Lock type which should by used. Set to null
to
allow query to use its current lock type.silentIfNullId
- Do not raise MissingRecordException
if some of the provided
IDs are null
. null
IDs are valid for
queries with OUTER join.MissingRecordException
- if any record cannot be loaded, because it is no longer
available (e.g., deleted, etc.).PersistenceException
- if there is an error loading data.Joinable.getRow()
public java.util.List<QueryOffEndListener> getOffEndListeners()
getOffEndListeners
in interface P2JQuery
public java.lang.Object[] getRow()
getRow
in interface Joinable
load(Object[], LockType, boolean)
public void repositionByID(recid id)
repositionByID
in interface P2JQuery
id
- A primary key ID, representing the target record (in the case
of a join, this ID is associated with the left-most record in
the join).ErrorConditionException
- if the specified ID represents the unknown value.public void repositionByID(rowid id1, rowid... joinIDs)
repositionByID
in interface P2JQuery
id1
- A primary key ID, representing the target record (in the case
of a join, this ID is associated with the left-most record in
the join).joinIDs
- All remaining primary key IDs, if any, arranged from left to
right to coincide with the records being joined by the
underlying query.ErrorConditionException
- if any of the specified IDs represents the unknown value.public void reposition(NumberType row)
reposition
in interface P2JQuery
row
- 1-based index of the target position.ErrorConditionException
- if row
represents unknown value.public void reposition(int row)
reposition
in interface P2JQuery
row
- 1-based index of the target position.ErrorConditionException
- if there is an error repositioning the cursor.public boolean forward(NumberType rows)
forward
in interface P2JQuery
rows
- Number of rows to scroll the cursor forward.true
if operation was successful and the cursor was moved the exact amount
of rows as specified by the parameter. If false
is returned then it is
possible that cursor's position was moved but not with rows
rows.ErrorConditionException
- if rows
represents the unknown value; if there is an error repositioning
the cursor.public boolean forward(int rows)
forward
in interface P2JQuery
rows
- Number of rows to scroll the cursor forward.true
if operation was successful and the cursor was moved the exact amount
of rows as specified by the parameter. If false
is returned then it is
possible that cursor's position was moved but not with rows
rows.ErrorConditionException
- if there is an error repositioning the cursor.public boolean backward(NumberType rows)
backward
in interface P2JQuery
rows
- Number of rows to scroll the cursor backward.true
if operation was successful and the cursor was moved the exact amount
of rows as specified by the parameter. If false
is returned then it is
possible that cursor's position was moved but not with rows
rows.ErrorConditionException
- if rows
represents the unknown value; if there is an error repositioning
the cursor.public boolean backward(int rows)
backward
in interface P2JQuery
rows
- Number of rows to scroll the cursor backward.true
if operation was successful and the cursor was moved the exact amount
of rows as specified by the parameter. If false
is returned then it is
possible that cursor's position was moved but not with rows
rows.ErrorConditionException
- if there is an error repositioning the cursor.public integer size()
Note that the first time this method is invoked, the database server may have to scroll to the end of the result set, which may be a time-consuming process for a large result set.
public integer currentRow()
currentRow
in interface P2JQuery
public integer currentRowImpl()
currentRowImpl
in interface P2JQuery
public logical isOffEnd()
isOffEnd
in interface P2JQuery
isOffEnd
in class AbstractQuery
true
if no record can be retrieved at the
cursor's current position; otherwise false
.public boolean _isOffEnd()
public boolean isFullRecords()
true
to return full records; false
to return primary
keys only.public void setFullRecords()
setFullRecords
in interface Joinable
public void reset(boolean resolveArgs)
This implementation nulls out the current result set, so that the next record retrieval request triggers a new server-side query. Optionally, it also resets resolvable substitution arguments and triggers where expression arguments to be resolved, if a client-side where cause expression is defined.
public void setUnknownRecord()
setUnknownRecord
in interface Joinable
RecordBuffer.setUnknownMode()
public int getTableCount()
getTableCount
in interface P2JQuery
public java.lang.Object[] peekFirst()
public java.lang.Object[] peekLast()
public java.lang.Object[] peekNext()
peekNext
in interface Scrollable
null
if there is no such result.public java.lang.Object[] peekPrevious()
peekPrevious
in interface Scrollable
null
if there is no such result.public boolean isPreselect()
isPreselect
in interface P2JQuery
true
.public void setResults(Results results)
setResults
in interface Joinable
results
- New result set for this query.public RecordBuffer[] getRecordBuffers()
getRecordBuffers
in interface Joinable
public java.lang.Object[] getArgs()
public java.lang.String getOriginalWhere()
getOriginalWhere
in interface Joinable
null
if there is none.public AbstractJoin getJoin()
public void forceDynamicOperation()
forceDynamicOperation
in interface Joinable
java.lang.UnsupportedOperationException
- always; this query type does not support dynamic retrieval.public java.lang.String getSortPhrase()
getSortPhrase
in interface Joinable
public AdaptiveComponent makeAdaptiveServerJoinComponent(java.util.List<AdaptiveComponent> joinList, AdaptiveQuery query, int iteration, boolean outer, CompoundComponent fallback)
makeAdaptiveServerJoinComponent
in interface Joinable
joinList
- List of adaptive components representing nested query loops which will contain
the adaptive query component returned by this method. The last component in the
list represents the nested query loop immediately containing the returned query
component, with which the join will be made.query
- Adaptive query which will manage the server-side join of joinList
and
the returned query component.iteration
- Iteration type: FIRST, LAST, or NEXT.outer
- true
if the join should be a left outer join. This type of join is
not supported at the time of this writing, so this parameter should always be
false
. It is here to support a planned, future enhancement.fallback
- A compound query component to use in the event the multi-table adaptive query
switches from preselect to dynamic retrieval mode.public QueryComponent makePreselectServerJoinComponent(java.util.List<QueryComponent> joinList, int iteration, boolean outer)
makePreselectServerJoinComponent
in interface Joinable
joinList
- List of preselect components representing nested query loops which will contain
the preselect query component returned by this method. The last component in the
list represents the nested query loop immediately containing the returned query
component, with which the join will be made.iteration
- Iteration type: FIRST, LAST, or NEXT.outer
- true
if the join should be a left outer join. This type of join is
not supported at the time of this writing, so this parameter should always be
false
. It is here to support a planned, future enhancement.public boolean hasWhereExpression()
hasWhereExpression
in interface Joinable
true
if there is a where expression; else false
.public void cleanup()
cleanup
in interface P2JQuery
cleanup
in class AbstractQuery
P2JQuery.cleanup()
public void open()
open
in interface P2JQuery
open
in class AbstractQuery
public void setScrolling()
setScrolling
in interface P2JQuery
setScrolling
in class AbstractQuery
public void setNonScrolling()
public OffEnd getOffEnd()
public character indexInformation(NumberType n)
indexInformation
in interface IndexInformation
indexInformation
in interface P2JQuery
indexInformation
in class AbstractQuery
n
- An integer expression that evaluates to the level of join for which you want index
information.public boolean isNativelyPreselect()
isNativelyPreselect
in interface P2JQuery
true
.public logical deleteResultListEntry(boolean allowBetweenRows)
deleteResultListEntry
in interface P2JQuery
deleteResultListEntry
in class AbstractQuery
allowBetweenRows
- If true
then the cursor can be positioned between rows (the next
row will be deleted). false
for conventional DELETE-RESULT-LIST-ENTRY()
mode where the cursor should be positioned on a row (otherwise false
is
returned).true
on success.public boolean isScrolling()
scrolling
flag has been set.isScrolling
in interface P2JQuery
true
if this is a scrolling query; else
false
.protected boolean isNativelyScrolling()
Subclasses which are not natively scrolling should override this method.
true
.protected void resetResults()
protected java.util.Iterator<QueryComponent> components()
protected boolean isLenientOffEnd()
QueryOffEndException
when it runs off the end of its
results.true
if an exception will be thrown, else
false
.protected boolean treatPreviousAsLast()
true
to treat a previous request as a request to
move to the last record in the list; else false
.protected void setEmptyBuffersUnknown()
protected AbstractJoin processJoin(BufferReference primary, BufferReference inverse)
AbstractJoin
helper
object which is used to implement the join.
It is intended that this method be called when adding a query component.
If no previous components have been added, a DynamicJoin
is created, and it is assumed that the inverse DMO is provided as a
query substitution parameter. If a component previously has been added,
a ServerJoin
is created, and it is assumed that the inverse
DMO will be resolved by a server-side join, rather than being provided
as a query substitution parameter.
If no inverse buffer is provided, no join is created.
primary
- Buffer reference to the primary DMO.inverse
- Buffer reference to the joined DMO, or null
if no
join is required.null
if no natural join
is required.protected void assembleSelectClause(java.lang.StringBuilder buf)
select {buffer0.id} [, {buffer1.id} [...]]
buf
- String buffer into which clause is assembled.protected void assembleFromClause(java.lang.StringBuilder buf, java.util.List<SortCriterion> sortCriteria) throws PersistenceException
from {Buffer0} as {buffer0} [, {Buffer1} as {buffer1} [, ...]]
Known Limitation: At this time, only theta-style joins are supported and as such, only inner joins are supported (there is no way to specify an outer join using theta-join syntax in HQL).
buf
- String buffer into which clause is assembled.sortCriteria
- List of SortCriterion
objects which describe the
sort behavior for this query.PersistenceException
- if there is an error creating the HQLPreprocessor
from which the composite join data are gathered.protected HQLExpression assembleWhereClause(java.util.List<SortCriterion> sortCriteria) throws PersistenceException
where ({component0_clause}) [and ({component1_clause}) [...]]
Please refer to the Hibernate reference documentation for permissible syntax of this clause.
sortCriteria
- List of SortCriterion
objects which describe the
sort behavior for this query.PersistenceException
- if there is an error creating the HQLPreprocessor
from which the preprocessed where clause is retrieved for each
query component.protected java.util.List<SortCriterion> assembleOrderByClause(java.lang.StringBuilder buf) throws PersistenceException
order by
clause for an HQL query. Uses the
form:
order by {{dmo.property} {asc/desc}} [, ...]
Any text-based sort criteria are augmented with the necessary upper() and rtrim() functions.
buf
- String buffer into which clause is assembled.SortCriterion
objects which describe the
sort behavior for this query.PersistenceException
- if the raw sort clause provided at construction contains any
unqualified property names; if the raw sort clause contains
a reference to an unrecognized record buffer.protected java.util.List<SortCriterion> assembleOrderByClauseNoPreamble(java.lang.StringBuilder buf, java.lang.String sort) throws PersistenceException
order by
clause for an HQL query, sans the
"order by" preamble. Uses the
form:
{{dmo.property} {asc/desc}} [, ...]
Any text-based sort criteria are augmented with the necessary upper() and rtrim() functions.
buf
- String buffer into which clause is assembled.sort
- Raw sort clause to parse and augment if necessary.SortCriterion
objects which describe the
sort behavior for this query.PersistenceException
- if sort
contains any unqualified property names;
if sort
clause contains a reference to an
unrecognized record buffer.protected java.util.List<SortCriterion> buildSortCriteria(java.lang.String sort) throws PersistenceException
SortCriterion
objects build from the given
sort clause.sort
- Raw sort clause to parse and augment if necessary.SortCriterion
objects which describe the
sort behavior for this query.PersistenceException
- if sort
contains any unqualified property names;
if sort
clause contains a reference to an
unrecognized record buffer.protected java.util.List<SortCriterion> assembleOrderByClauseNoPreamble(java.lang.StringBuilder buf, java.util.List<SortCriterion> sortCriteria)
order by
clause for an HQL query, sans the
"order by" preamble. Uses the
form:
{{dmo.property} {asc/desc}} [, ...]
Any text-based sort criteria are augmented with the necessary upper() and rtrim() functions.
buf
- String buffer into which clause is assembled.sortCriteria
- A list of SortCriterion
objects which describe
the sorting to be applied.SortCriterion
objects which describe the
sort behavior for this query.protected java.util.List<java.util.function.Supplier<logical>> getWhereExpressions()
protected java.util.Iterator<java.util.function.Supplier<logical>> whereExpressions()
protected boolean execute()
true
if query was executed for the first time;
false
if query was executed previously and we
already have a result set.ErrorConditionException
- if an error occurs executing the query.java.lang.IllegalStateException
- if no query component has been added to this query.protected boolean isTopLevelCleanup()
This default implementation returns false
, indicating
results should be cleaned up at the nearest enclosing scope.
Subclasses which require different behavior must override this method.
false
.protected boolean verifyJoins()
true
if verification succeeded and query execution
should continue; else false
protected void handleMissingJoinRecord()
This implementation creates an empty result set.
protected SimpleResults cacheResults(Results target)
SimpleResults
instance. If this is a scrolling query, this
will cache all results in the target result set, including those already
visited. Otherwise, only the current result and all remaining,
unvisited results are cached.target
- Result set which is to be cached, presumably because it will
be invalid momentarily. If this is already an instance of
SimpleResults
, it is simply returned.target
, if any, cached in an instance
of SimpleResults
. If there were no results
available to cache, an empty result set is returned. If any of
the record buffers backing this query have been closed,
null
is returned.protected void prepareParameters(java.util.List<java.lang.Object> args, java.util.List<org.hibernate.type.Type> types) throws PersistenceException
args
and types
lists for each ?
placeholder in the HQL query string for
this query.args
- Argument list to be populated.types
- Type list to be populated. This may be populated with
null
values, but it must coincide in size and in
the absolute positions of its elements with the
args
list. Any null
element will
be filled in later.PersistenceException
- if there is an error creating an HQLPreprocessor
during the gathering of query substitution parameters.protected java.lang.String[] getEntities()
protected java.io.Serializable getTemplateQueryRowid(java.lang.Object[] args)
Note:
The current implementation identifies only simple queries for template records:
PreselectQuery
has a single component;HQLPreprocessor
of the component);FOR EACH book WHERE RECID(book) = templateId OR book.isbn NE ?
On the other hand, it does not make much sense to:
args
- The actual parameters of the query.null
otherwise.protected Results executeQuery(Persistence persistence, java.lang.String hql, java.lang.Object[] args, org.hibernate.type.Type[] types) throws PersistenceException
This default implementation returns an object which is a thin wrapper around
ScrollableResults
. Subclasses may override this method if they need a
Results
implementation other than ScrollingResults
.
In case when the hql
represents a valid template record query (a test on recid /
rowid of the record against the unique _file._template
for current record of the
single QueryComponent
), a special Results
object is returned with a single
element that is the template record for the buffer of the component.
persistence
- Object which is used to execute the query.hql
- HQL query string.args
- Substitution parameters to be inserted into placeholders within within the HQL
query string.types
- Query substitution parameter types.ScrollingResults
which wrappers the
ScrollableResults
object returned by the execution of the query.PersistenceException
- if there is an error executing the query.protected org.hibernate.ScrollableResults executeScroll(Persistence persistence, java.lang.String hql, java.lang.Object[] args, org.hibernate.type.Type[] types) throws PersistenceException
ScrollableResults
result set.persistence
- Object which is used to execute the query.hql
- HQL query string.args
- Substitution parameters to be inserted into placeholders within
within the HQL query string.types
- Query substitution parameter types.ScrollableResults
object returned by the
execution of the query.PersistenceException
- if there is an error executing the query.protected Results createResults(Results results) throws PersistenceException
Results
implementation (for client-side where processing).
It is this object which actually will be used to retrieve the primary
key values of records to be loaded from the database.
If no filtering is necessary, simply return the results object which was passed in.
Subclasses may override this method to insert their own layers into result set processing.
results
- An object which manipulates the database result set returned
from execution of the query.Results
object.PersistenceException
- if there is any error creating results.protected void fetch(boolean available, LockType lockType, boolean errorIfNull) throws MissingRecordException
As particular case when the query looks for the template record of the buffer of the single
QueryComponent
, the buffer is not populated with a record fetched from backing
database, instead the template record for the buffer is automatically created in-memory.
This results
object has only one element to iterate on and attempting to iterate on
this object will throw QueryOffEndException
and release the buffer.
available
- true
if the most recent scrollable cursor move left the cursor at an
available result row; false
if the cursor cannot read a result at its
current position.lockType
- Overriding lock type to apply to fetched records. If null
, default lock
types are applied.errorIfNull
- true
if failed retrievals should raise error.MissingRecordException
- if the record was expected to be available, but wasn't. This typically indicates
the record was deleted between the time it initially was found by the query and the
time it was to be fetched to store in the record buffer.ErrorConditionException
- if the fetch of any record fails or if no records are available and the query is
set to fail in this case.QueryOffEndException
- if no records are available and the query is set not to fail in this case.protected final void coreFetch(java.lang.Object[] data, LockType lockType, boolean errorIfNull, boolean silentIfNullId) throws PersistenceException
data
- An array of primary key IDs or DMOs representing records to be
fetched for the composite row.lockType
- Overriding lock type to apply to fetched records. If
null
, default lock types are applied.errorIfNull
- true
if failed retrievals should raise error.silentIfNullId
- If true
, do not raise QueryOffEndException
if some of the provided IDs are null
. null
IDs are valid for queries with OUTER join.MissingRecordException
- if the record was expected to be available, but wasn't. This
typically indicates the record was deleted between the time it
initially was found by the query and the time it was to be
fetched to store in the record buffer.PersistenceException
- if the fetch of any record fails.ErrorConditionException
- if no records are available and the query is set to fail in
this case.QueryOffEndException
- if no records are available and the query is set not to fail
in this case.protected final boolean isClientWhere()
true
if client-side filter is required, else
false
.protected Results getResults()
Results
object for this query.Results
object.protected void addComponent(QueryComponent comp)
comp
- Query component to be added.java.lang.UnsupportedOperationException
- if attempting an outer join (temporary);
if iteration type is not NEXT
(temporary);
if the component's DMO's associated database is different than
that of a previously added component's database (cross-database
preselect joins are not possible).protected boolean supportsArbitraryIteration()
false
protected boolean preserveBuffersOnEmptyResults()
This implementation always returns false. Subclasses should override this behavior if needed.
false
.protected void clearRepoCache()
protected java.lang.String getHQL()
null
if the query has not yet been
executed.protected Persistence getPersistence()
protected void registerCleaner()
Finalizable
with the transaction manager for
resource cleanup when this query's scope ends.protected boolean repositionByID(java.io.Serializable[] ids, boolean forceFetch)
ids
- Array of primary key IDs, arranged from left to right to
coincide with the records being joined by the underlying
query.forceFetch
- true
to override the current fetch-on-reposition
setting to true
, in case the underlying
Results
implementation attempts to fetch the
record during repositioning; false
to honor the
current setting.true
if reposition was successful;
false
if unsuccessful.ErrorConditionException
- if there is an error repositioning the cursor.protected void prepareReposition()
private QueryComponent findComponent(RecordBuffer buffer)
buffer
- Record buffer.null
if not found.private java.lang.String assembleHQL() throws PersistenceException
PersistenceException
- if the sort criteria reference unqualified or unrecognized
buffer names.private boolean validateRepositionByID(rowid value)
value
- ID to be validated.true
if the number is valid; false
if it is invalid, but we are in silent error mode.ErrorConditionException
- if the number is invalid and we are not in silent error mode.private boolean validateRepositionByID(recid value)
value
- ID to be validated.true
if the number is valid; false
if it is invalid, but we are in silent error mode.ErrorConditionException
- if the number is invalid and we are not in silent error mode.private boolean validateReposition(NumberType value)
value
- ID or row number/offset to be validated.true
if the number is valid; false
if it is invalid, but we are in silent error mode.ErrorConditionException
- if the number is invalid and we are not in silent error mode.private boolean validateRepositionImpl(BaseDataType value, int errorNum, java.lang.String errorMsg)
value
- ID or row number/offset to be validated.errorNum
- Error number if validation fails.errorMsg
- Error message if validation fails.true
if the number is valid; false
if it is invalid.ErrorConditionException
- if the number is invalid and we are not in silent error mode.