public final class PresortQuery extends PreselectQuery implements Presortable, PresortDelegate
Resolvable
provided by business application code to sort the
result set returned by the database. This class supports the Progress
semantics of "client-side" results sorting and break groups. Multiple
levels of nested break groups are supported.
Sorting criteria is specified using the addSortCriterion
method. The order in which criteria are added is significant; the first
criterion added dictates the coarsest level of sorting. Each criterion
added subsequently only sorts rows within that criterion added immediately
previous to it.
P2JQuery.Parameter
SessionListener.Event, SessionListener.Scope
Modifier and Type | Field and Description |
---|---|
private Presorter |
sorter
Helper which sorts preselected, unsorted results
|
betweenRows, components, currentRowDeleted, offEnd, sort
closed, inverseSorting, parameterFilter
CURRENT, FIRST, LAST, NEXT, NONE, PREVIOUS, RETRIEVE_MODES, UNIQUE
Constructor and Description |
---|
PresortQuery()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addComponent(QueryComponent comp)
Add a component to the query.
|
void |
addSortCriterion(Resolvable sort)
Add a single sort criterion, in the form of a
Resolvable
object which is resolved at sort time. |
void |
addSortCriterion(Resolvable sort,
boolean descending)
Add a single sort criterion, in the form of a
Resolvable
object which is resolved at runtime. |
protected java.util.List<SortCriterion> |
assembleOrderByClause(java.lang.StringBuilder buf)
Assemble the
order by clause for an HQL query. |
protected void |
assembleSelectClause(java.lang.StringBuilder buf)
Assemble the select clause for an HQL query.
|
protected Results |
createResults(Results results)
Given the scrollable results set for the query, create an object which
implements the
Results interface. |
void |
enableBreakGroups()
Enable all sort criteria set for this query to act as break group
categories.
|
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. |
Results |
getSortedResults()
Access the current, sorted results for this query.
|
PresortQuery |
initialize()
Initialization logic which is typically used for a multi-table query.
|
PresortQuery |
initialize(boolean lenientOffEnd)
Initialization logic which is typically used for a multi-table query.
|
PresortQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr)
Initialization logic designed for a single-table preselect query.
|
PresortQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
DataModelObject inverse)
Initialization logic designed for a single-table preselect query.
|
PresortQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
DataModelObject inverse,
LockType lockType)
Initialization logic designed for a single-table preselect query.
|
PresortQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
DataModelObject inverse,
java.lang.Object[] args)
Initialization logic designed for a single-table preselect query.
|
PresortQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
DataModelObject inverse,
java.lang.Object[] args,
LockType lockType)
Initialization logic designed for a single-table preselect query.
|
PresortQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
LockType lockType)
Initialization logic designed for a single-table preselect query.
|
PresortQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.Object[] args)
Initialization logic designed for a single-table preselect query.
|
PresortQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.Object[] args,
LockType lockType)
Initialization logic designed for a single-table preselect query.
|
PresortQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort)
Initialization logic designed for a single-table preselect query.
|
PresortQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
DataModelObject inverse)
Initialization logic designed for a single-table preselect query.
|
PresortQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
DataModelObject inverse,
LockType lockType)
Initialization logic designed for a single-table preselect query.
|
PresortQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
DataModelObject inverse,
java.lang.Object[] args)
Initialization logic designed for a single-table preselect query.
|
PresortQuery |
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)
Initialization logic designed for a single-table preselect query.
|
PresortQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
LockType lockType)
Initialization logic designed for a single-table preselect query.
|
PresortQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
java.lang.Object[] args)
Initialization logic designed for a single-table preselect query.
|
PresortQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
java.lang.Object[] args,
LockType lockType)
Initialization logic designed for a single-table preselect query.
|
PresortQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
java.lang.String indexInfo)
Initialization logic designed for a single-table preselect query.
|
PresortQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
java.lang.String indexInfo,
DataModelObject inverse)
Initialization logic designed for a single-table preselect query.
|
PresortQuery |
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)
Initialization logic designed for a single-table preselect query.
|
PresortQuery |
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)
Initialization logic designed for a single-table preselect query.
|
PresortQuery |
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)
Initialization logic designed for a single-table preselect query.
|
PresortQuery |
initialize(DataModelObject dmo,
java.lang.String where,
java.util.function.Supplier<logical> whereExpr,
java.lang.String sort,
java.lang.String indexInfo,
LockType lockType)
Initialization logic designed for a single-table preselect query.
|
PresortQuery |
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)
Initialization logic designed for a single-table preselect query.
|
PresortQuery |
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)
Initialization logic designed for a single-table preselect query.
|
logical |
isFirst()
Determine whether the query result row currently being visited is the
first row in the presorted results list.
|
logical |
isFirstOfGroup(Resolvable key)
Determine whether the query result row currently being visited is the
first row within a break group whose category is identified by the
specified resolvable object.
|
logical |
isLast()
Determine whether the query result row currently being visited is the
last row in the presorted results list.
|
protected boolean |
isLastOfBreakGroup(Resolvable key)
Determine whether the query result row currently being visited is the
last row within a break group whose category is identified by the
specified resolvable object.
|
logical |
isLastOfGroup(Resolvable key)
Determine whether the query result row currently being visited is the
last row within a break group whose category is identified by the
specified resolvable object.
|
protected boolean |
isNativelyScrolling()
Indicate whether this query type is scrolling by its nature.
|
protected boolean |
isNewBreakGroup(Resolvable key)
Determine whether the query result row currently being visited is the
first row within a break group whose category is identified by the
specified resolvable object.
|
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.
|
protected boolean |
supportsArbitraryIteration()
Does this query support non-NEXT iteration components?
|
_isOffEnd, addComponent, addComponent, addComponent, addComponent, addComponent, addComponent, addComponent, addComponent, addComponent, addComponent, addComponent, addComponent, addComponent, addComponent, addComponent, addComponent, addComponent, addComponent, addComponent, addComponent, addWhereExpression, assembleFromClause, assembleOrderByClauseNoPreamble, assembleOrderByClauseNoPreamble, assembleWhereClause, backward, backward, buildSortCriteria, cacheResults, cleanup, clearRepoCache, components, coreFetch, current, current, currentRow, currentRowImpl, deleted, deleteResultListEntry, deregisteredSessionListener, execute, executeQuery, fetch, finished, first, first, forceDynamicOperation, forward, forward, getArgs, getEntities, getHQL, getJoin, getOffEnd, getOffEndListeners, getOriginalWhere, getPersistence, getRecordBuffers, getResults, getRow, getSortPhrase, getTableCount, getTemplateQueryRowid, getWhereExpressions, handleMissingJoinRecord, hasWhereExpression, indexInformation, initialize, initialize, isClientWhere, isFullRecords, isLenientOffEnd, isNativelyPreselect, isOffEnd, isPreselect, isScrolling, isTopLevelCleanup, iterate, last, last, load, makeAdaptiveServerJoinComponent, makePreselectServerJoinComponent, next, next, open, peekFirst, peekLast, peekNext, peekPrevious, prepareParameters, prepareReposition, previous, previous, processJoin, registerCleaner, registerRecordChangeListeners, reposition, reposition, repositionByID, repositionByID, repositionByID, reset, resetResults, retry, sessionEvent, setEmptyBuffersUnknown, setFullRecords, setIterationType, setIterationType, setLenientOffEnd, setNonScrolling, setResults, setScrolling, setUnknownRecord, size, toString, treatPreviousAsLast, unique, unique, verifyJoins, whereExpressions
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, 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
getRecordBuffers
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 Presorter sorter
public PresortQuery()
initialize()
is
called.public PresortQuery initialize()
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.
public PresortQuery initialize(boolean lenientOffEnd)
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.public PresortQuery initialize(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr)
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
.public PresortQuery 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.
initialize
in class PreselectQuery
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
- Sort clause that corresponds the index which defines the sort
order for this query. May be null
.public PresortQuery 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.
initialize
in class PreselectQuery
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
- Sort clause that corresponds the index which defines the sort
order for this query. 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 PresortQuery initialize(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, 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
.inverse
- DMO to which this query should join via a foreign relation.
May be null
.public PresortQuery 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.
initialize
in class PreselectQuery
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
- Sort clause that corresponds the index which defines the sort
order for this query. May be null
.inverse
- DMO to which this query should join via a foreign relation.
May be null
.public PresortQuery 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.
initialize
in class PreselectQuery
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
- Sort clause that corresponds the index which defines the sort
order for this query. 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 PresortQuery initialize(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, 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
.args
- Substitution parameters to be inserted into placeholders within
the where clause.public PresortQuery 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.
initialize
in class PreselectQuery
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
- Sort clause that corresponds the index which defines the sort
order for this query. May be null
.args
- Substitution parameters to be inserted into placeholders within
the where clause.public PresortQuery 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.
initialize
in class PreselectQuery
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
- Sort clause that corresponds the index which defines the sort
order for this query. 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 PresortQuery initialize(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, 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
.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 PresortQuery 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.
initialize
in class PreselectQuery
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
- Sort clause that corresponds the index which defines the sort
order for this query. 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 PresortQuery 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.
initialize
in class PreselectQuery
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
- Sort clause that corresponds the index which defines the sort
order for this query. 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 PresortQuery initialize(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, 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
.lockType
- Lock type to apply to records retrieved by this query.public PresortQuery 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.
initialize
in class PreselectQuery
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
- Sort clause that corresponds the index which defines the sort
order for this query. May be null
.lockType
- Lock type to apply to records retrieved by this query.public PresortQuery 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.
initialize
in class PreselectQuery
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
- Sort clause that corresponds the index which defines the sort
order for this query. 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 query.public PresortQuery initialize(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, 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
.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 PresortQuery 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.
initialize
in class PreselectQuery
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
- Sort clause that corresponds the index which defines the sort
order for this query. 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 query.public PresortQuery 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.
initialize
in class PreselectQuery
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
- Sort clause that corresponds the index which defines the sort
order for this query. 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 query.public PresortQuery initialize(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, 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
.args
- Substitution parameters to be inserted into placeholders within
the where clause.lockType
- Lock type to apply to records retrieved by this query.public PresortQuery 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.
initialize
in class PreselectQuery
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
- Sort clause that corresponds the index which defines the sort
order for this query. 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 PresortQuery 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.
initialize
in class PreselectQuery
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
- Sort clause that corresponds the index which defines the sort
order for this query. 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 query.public PresortQuery initialize(DataModelObject dmo, java.lang.String where, java.util.function.Supplier<logical> whereExpr, 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
.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 PresortQuery 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.
initialize
in class PreselectQuery
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
- Sort clause that corresponds the index which defines the sort
order for this query. 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 query.public PresortQuery 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.
initialize
in class PreselectQuery
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
- Sort clause that corresponds the index which defines the sort
order for this query. 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 query.public void addSortCriterion(Resolvable sort)
Resolvable
object which is resolved at sort time. It is the value of the resolved
result which is used for the sort.
The sort is ascending, from lowest resolved value to highest.
addSortCriterion
in interface PresortDelegate
sort
- A resolvable object whose resolved result is used for sorting.public void addSortCriterion(Resolvable sort, boolean descending)
Resolvable
object which is resolved at runtime. It is the value of the resolved
result which is used for the sort.addSortCriterion
in interface PresortDelegate
descending
- if true
, the sort is descending, from highest
resolved value to lowest; otherwise, the sort is ascending.sort
- A resolvable object whose resolved result is used for sorting.public void enableBreakGroups()
enableBreakGroups
in interface PresortDelegate
public logical isFirst()
isFirst
in interface PresortDelegate
true
if the current result row is the first row,
else false
.public logical isFirstOfGroup(Resolvable key)
isFirstOfGroup
in interface PresortDelegate
key
- Break group category key. Must be the same object reference
as was specified previously when invoking one of the
addSortCriterion
method variants.true
if break groups are enabled and current row
is first in the specified break group;
false
if break groups have not been enabled or
current row is not first in the specified break group.public logical isLast()
isLast
in interface PresortDelegate
true
if the current result row is the last row,
else false
.public logical isLastOfGroup(Resolvable key)
isLastOfGroup
in interface PresortDelegate
key
- Break group category key. Must be the same object reference
as was specified previously when invoking one of the
addSortCriterion
method variants.true
if break groups are enabled and current row
is last in the specified break group;
false
if break groups have not been enabled or
current row is not last in the specified break group.public Results getSortedResults()
getSortedResults
in interface Presortable
Results
object used to retrieve sorted results.protected void addComponent(QueryComponent comp)
addComponent
in class PreselectQuery
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()
supportsArbitraryIteration
in class PreselectQuery
true
protected boolean preserveBuffersOnEmptyResults()
This implementation returns true only if break groups are enabled.
preserveBuffersOnEmptyResults
in class PreselectQuery
true
if break groups are enabled, else false
.protected boolean isLastOfBreakGroup(Resolvable key)
isLastOfBreakGroup
in class AbstractQuery
key
- Break group category key. Must be the same object reference
as was specified previously when invoking one of the
addSortCriterion
method variants.true
if break groups are enabled and current row
is last in the specified break group;
false
if break groups have not been enabled or
current row is not last in the specified break group.protected boolean isNewBreakGroup(Resolvable key)
This is the backing worker method for isFirstOfGroup(com.goldencode.p2j.util.Resolvable)
and is
used internally by the query to manage accumulators.
isNewBreakGroup
in class AbstractQuery
key
- Break group category key. Must be the same object reference
as was specified previously when invoking one of the
addSortCriterion
method variants.true
if current row is first in a break group;
false
if it is not; unknown value if break groups
have not been enabled.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.
Override the parent's implementation to use a ScrollMode
of
FORWARD_ONLY
, which may permit the use of a server-side
cursor by the JDBC driver.
executeScroll
in class PreselectQuery
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
interface. It is this object which
will actually be used to retrieve the primary key values of records to
be loaded from the database.
This implementation returns a specialized Results
object,
which sorts the results obtained from the caller, according to one or
more sort criterion provided by client code.
createResults
in class PreselectQuery
results
- An object used to access the records which meet this query's
criteria.Results
object which presorts the results.PersistenceException
- if there is any error creating resultsprotected boolean isNativelyScrolling()
Subclasses which are not natively scrolling should override this method.
isNativelyScrolling
in class PreselectQuery
false
.protected void assembleSelectClause(java.lang.StringBuilder buf)
select {buffer0} [, {buffer1} [...]]
This method overrides the parent's implementation to make it a full query, rather than projection query which returns only the record's primary key. This is necessary to presort the results without issuing a separate select to the database to retrieve each record during the presort process.
assembleSelectClause
in class PreselectQuery
buf
- String buffer into which clause is assembled.protected java.util.List<SortCriterion> assembleOrderByClause(java.lang.StringBuilder buf) throws PersistenceException
order by
clause for an HQL query. Uses the
form (ordered only by primary keys):
order by {dmo.id asc} [, ...]
assembleOrderByClause
in class PreselectQuery
buf
- String buffer into which clause is assembled.SortCriterion
objects which describe the
sort behavior for this query.PersistenceException
- never.