public interface Select extends SelectExecutor
Modifier and Type | Field and Description |
---|---|
static int |
EAGER_INNER
Constant indicating to batch the select using an inner join.
|
static int |
EAGER_OUTER
Constant indicating to batch the select using an outer join.
|
static int |
EAGER_PARALLEL
Constant indicating to use a separate select executed in parallel.
|
static String |
FROM_SELECT_ALIAS
The alias to use for the from select, if any.
|
static int |
SUBS_ANY_JOINABLE
Constant indicating to select subclasses but without adding any
class conditions to the select.
|
static int |
SUBS_EXACT
Constant indicating to select this class but without adding any
class conditions to the select.
|
static int |
SUBS_JOINABLE
Constant indicating to add conditions to the selcet to select this
class and joinable subclasses only.
|
static int |
SUBS_NONE
Constant indicating to add conditions to the select to select this
class only.
|
static int |
TYPE_JOINLESS
Constant indicating a select can be made without joins.
|
static int |
TYPE_TWO_PART
Constant indicating a two-part select and load.
|
Modifier and Type | Method and Description |
---|---|
void |
addJoinClassConditions()
Apply class conditions from relation joins.
|
Joins |
and(Joins joins1,
Joins joins2)
AND the given joins together.
|
void |
append(SQLBuffer buf,
Joins joins)
Append the given joins to the given buffer.
|
void |
clearOrdering()
Clear odering conditions.
|
void |
clearSelects()
Clear the existing column selects.
|
Context |
ctx()
Return the JPQL query context of this select
|
SelectExecutor |
eagerClone(FieldMapping key,
int eagerType,
boolean toMany,
int sels)
Return a select that will be eagerly executed with this one, or null if
the select cannot be created for the given key and join type.
|
SelectExecutor |
fullClone(int sels)
Return a SELECT that is a complete clone of this one.
|
String |
getColumnAlias(Column col)
Return the alias for the given column.
|
String |
getColumnAlias(Column col,
Joins joins)
Return the alias for the given column.
|
String |
getColumnAlias(Column col,
Object path)
Return the alias for the given column, without creating new table alias
|
String |
getColumnAlias(String col,
Table table)
Return the alias for the given column.
|
String |
getColumnAlias(String col,
Table table,
Joins joins)
Return the alias for the given column.
|
DBDictionary |
getDictionary() |
SelectExecutor |
getEager(FieldMapping key)
Return the eager select for the given key.
|
long |
getEndIndex()
The result end index.
|
List |
getExcludedJoinedTableClassMeta()
get joined table metadatas excluded for polymorphic queries
|
Select |
getFromSelect()
Another select instance that creates a temporary table from which
this select pulls data.
|
SQLBuffer |
getGrouping()
Return the grouping SQL for this select.
|
boolean |
getHasSubselect()
Return the flag to indicate whether this Select has
internally generated subselect
|
SQLBuffer |
getHaving()
Return the HAVING clause, or null if none.
|
List |
getIdentifierAliases()
Get the aliases for identifier columns that can be used in COUNT
selects to find the number of matches.
|
List |
getJoinedTableClassMeta()
get joined table metadatas for polymorphic queries
|
Iterator |
getJoinIterator()
Return the top-level
Join elements for this select. |
Joins |
getJoins()
Return the top-level joins for this select.
|
SQLBuffer |
getOrdering()
Return the ordering SQL for this select.
|
Select |
getParent()
Return the parent of this select, if it is a subselect.
|
List |
getSelectAliases()
Return the aliases of all selected columns and all selected buffers,
in the order they were selected.
|
List |
getSelects()
Return the actual
Val s and Column s that were
selected, in the order that they were selected. |
long |
getStartIndex()
The result start index.
|
String |
getSubselectPath()
Return the subselect path for this select, if it is a subselect.
|
List |
getSubselects()
Return this select's subselects, or empty collection if none.
|
Collection |
getTableAliases()
Return the set of all used table aliases.
|
ClassMapping |
getTablePerClassMeta()
get table-per-class metadata for polymorphic queries
|
SQLBuffer |
getWhere()
Return the WHERE clause, minus any necessary end joins.
|
void |
groupBy(ClassMapping mapping,
int subclasses,
JDBCStore store,
JDBCFetchConfiguration fetch)
Group by the columns of the given mapping, possibly including subclasses.
|
void |
groupBy(ClassMapping mapping,
int subclasses,
JDBCStore store,
JDBCFetchConfiguration fetch,
Joins joins)
Group by the columns of the given mapping, possibly including subclasses.
|
void |
groupBy(Column col)
Group by the given column.
|
void |
groupBy(Column[] cols)
Group by the given columns.
|
void |
groupBy(Column[] cols,
Joins joins)
Group by the given columns.
|
void |
groupBy(Column col,
Joins joins)
Group by the given column.
|
void |
groupBy(SQLBuffer sql)
Add a GROUP BY clause.
|
void |
groupBy(SQLBuffer sql,
Joins joins)
Add a GROUP BY clause.
|
void |
groupBy(String sql)
Add a GROUP BY clause.
|
void |
groupBy(String sql,
Joins joins)
Add a GROUP BY clause.
|
boolean |
hasEagerJoin(boolean toMany)
Whether this select has an eager join of the specified type.
|
boolean |
hasJoin(boolean toMany)
Whether this select has a join of the specified type.
|
void |
having(SQLBuffer sql)
Add the given having conditions.
|
void |
having(SQLBuffer sql,
Joins joins)
Add the given having conditions.
|
void |
having(String sql)
Add the given having conditions.
|
void |
having(String sql,
Joins joins)
Add the given having conditions.
|
int |
indexOf()
The index of this select within the UNION, or 0.
|
boolean |
isAggregate()
Return true if this is an aggregate select.
|
boolean |
isLob()
Return true if this select includes a LOB.
|
boolean |
isSelected(Table table)
Return whether the given table is being used in this select.
|
void |
logEagerRelations()
Extended trace that logs eager relations
|
Joins |
newJoins()
Return a new instance to use for joining.
|
Joins |
newOuterJoins()
Return a new instance to use for outer joining.
|
Joins |
or(Joins joins1,
Joins joins2)
OR the given joins together.
|
int |
orderBy(Column[] cols,
boolean asc,
boolean sel)
Order by the given columns.
|
int |
orderBy(Column[] cols,
boolean asc,
Joins joins,
boolean sel)
Order by the given columns.
|
boolean |
orderBy(Column col,
boolean asc,
boolean sel)
Order by the given column.
|
boolean |
orderBy(Column col,
boolean asc,
Joins joins,
boolean sel)
Order by the given column.
|
boolean |
orderBy(SQLBuffer sql,
boolean asc,
boolean sel,
Value selAs)
Add an ORDER BY clause.
|
boolean |
orderBy(SQLBuffer sql,
boolean asc,
Joins joins,
boolean sel,
Value selAs)
Add an ORDER BY clause.
|
boolean |
orderBy(String sql,
boolean asc,
boolean sel)
Add an ORDER BY clause.
|
boolean |
orderBy(String sql,
boolean asc,
Joins joins,
boolean sel)
Add an ORDER BY clause.
|
int |
orderByPrimaryKey(ClassMapping mapping,
boolean asc,
boolean sel)
Order on the primary key columns of the given mapping,
joining to superclasses as necessary to get all columns needed to
construct an object id.
|
int |
orderByPrimaryKey(ClassMapping mapping,
boolean asc,
Joins joins,
boolean sel)
Select and order on the primary key columns of the given mapping,
joining to superclasses as necessary to get all columns needed to
construct an object id.
|
Joins |
outer(Joins joins)
Return a join set making the given joins outer joins.
|
void |
select(ClassMapping mapping,
int subclasses,
JDBCStore store,
JDBCFetchConfiguration fetch,
int eager)
Select the columns of the given mapping, possibly including subclasses.
|
void |
select(ClassMapping mapping,
int subclasses,
JDBCStore store,
JDBCFetchConfiguration fetch,
int eager,
Joins joins)
Select the columns of the given mapping, possibly including subclasses.
|
boolean |
select(Column col)
Select the given column.
|
int |
select(Column[] cols)
Select the given columns.
|
int |
select(Column[] cols,
Joins joins)
Select the given columns.
|
boolean |
select(Column col,
Joins joins)
Select the given column.
|
boolean |
select(SQLBuffer sql,
Object id)
Select the given SQL; the given id object is an identifier
to use when retrieving the corresponding value from a
Result . |
boolean |
select(SQLBuffer sql,
Object id,
Joins joins)
Select the given SQL; the given id object is an identifier
to use when retrieving the corresponding value from a
Result . |
boolean |
select(String sql,
Object id)
Select the given SQL; the given id object is an identifier
to use when retrieving the corresponding value from a
Result . |
boolean |
select(String sql,
Object id,
Joins joins)
Select the given SQL; the given id object is an identifier
to use when retrieving the corresponding value from a
Result . |
void |
selectIdentifier(ClassMapping mapping,
int subclasses,
JDBCStore store,
JDBCFetchConfiguration fetch,
int eager)
Select the columns of the given mapping, possibly including subclasses.
|
void |
selectIdentifier(ClassMapping mapping,
int subclasses,
JDBCStore store,
JDBCFetchConfiguration fetch,
int eager,
Joins joins)
Select the columns of the given mapping, possibly including subclasses.
|
boolean |
selectIdentifier(Column col)
Select the given column as one that can be used to get a count of
distinct matches.
|
int |
selectIdentifier(Column[] cols)
Select the given columns as ones that can be used to get a count of
distinct matches.
|
int |
selectIdentifier(Column[] cols,
Joins joins)
Select the given columns as ones that can be used to get a count of
distinct matches.
|
boolean |
selectIdentifier(Column col,
Joins joins)
Select the given column as one that can be used to get a count of
distinct matches.
|
void |
selectPlaceholder(String sql)
Select the given SQL as a placeholder for a UNION element.
|
int |
selectPrimaryKey(ClassMapping mapping)
Select the primary key columns of the given mapping, joining to
superclasses as necessary to get all columns needed to construct
an object id.
|
int |
selectPrimaryKey(ClassMapping mapping,
Joins joins)
Select the primary key columns of the given mapping, joining to
superclasses as necessary to get all columns needed to construct
an object id.
|
void |
setAggregate(boolean agg)
Set to true for aggregate selects.
|
void |
setContext(Context context)
Set JPQL query context for this select
|
void |
setExcludedJoinedTableClassMeta(List meta)
Set joined table metadatas excluded for polymorphic queries
|
void |
setFromSelect(Select sel)
Another select instance that creates a temporary table from which
this select pulls data.
|
void |
setHasSubselect(boolean hasSub)
Set the flag to indicate whether this Select has
internally generated subselect
|
void |
setJoinedTableClassMeta(List meta)
Set joined table metadatas for polymorphic queries
|
void |
setLob(boolean lob)
Set to true for selects that include LOB columns.
|
void |
setParent(Select parent,
String path)
Turn this select into a subselect of the given instance.
|
void |
setRange(long start,
long end)
Set the result range for this select.
|
void |
setSchemaAlias(String schemaAlias)
Record the initial schemaAlias of a join path
|
void |
setTablePerClassMeta(ClassMapping meta)
Set table-per-class metadata for polymorphic queries
|
String |
toString()
Implement toString to generate SQL string for profiling/debuggging.
|
void |
where(Joins joins)
Add the given where conditions.
|
void |
where(SQLBuffer sql)
Add the given where conditions.
|
void |
where(SQLBuffer sql,
Joins joins)
Add the given where conditions.
|
void |
where(String sql)
Add the given where conditions.
|
void |
where(String sql,
Joins joins)
Add the given where conditions.
|
SelectExecutor |
whereClone(int sels)
Return a SELECT with the same joins and where conditions as this one.
|
void |
whereForeignKey(ForeignKey fk,
Object oid,
ClassMapping mapping,
JDBCStore store)
Add where conditions setting the given foreign key to the given
oid values.
|
void |
wherePrimaryKey(Object oid,
ClassMapping mapping,
JDBCStore store)
Add where conditions setting the mapping's primary key to the given
oid values.
|
execute, execute, getAutoDistinct, getConfiguration, getCount, getExpectedResultCount, getJoinSyntax, getSQL, hasMultipleSelects, isDistinct, isLRS, setAutoDistinct, setDistinct, setExpectedResultCount, setJoinSyntax, setLRS, supportsLocking, supportsRandomAccess, toSelect, toSelectCount
static final int EAGER_INNER
static final int EAGER_OUTER
static final int EAGER_PARALLEL
static final int TYPE_JOINLESS
static final int TYPE_TWO_PART
static final int SUBS_JOINABLE
static final int SUBS_NONE
static final int SUBS_ANY_JOINABLE
static final int SUBS_EXACT
static final String FROM_SELECT_ALIAS
int indexOf()
List getSubselects()
Select getParent()
String getSubselectPath()
void setParent(Select parent, String path)
Select getFromSelect()
void setFromSelect(Select sel)
boolean hasEagerJoin(boolean toMany)
boolean hasJoin(boolean toMany)
boolean isSelected(Table table)
Collection getTableAliases()
List getSelects()
Val
s and Column
s that were
selected, in the order that they were selected.List getSelectAliases()
SQLBuffer
.List getIdentifierAliases()
SQLBuffer getOrdering()
SQLBuffer getGrouping()
SQLBuffer getWhere()
SQLBuffer getHaving()
void addJoinClassConditions()
getJoins()
, getJoinIterator()
, and
getWhere()
.Joins getJoins()
long getStartIndex()
long getEndIndex()
void setRange(long start, long end)
String getColumnAlias(Column col, Joins joins)
String getColumnAlias(String col, Table table)
String getColumnAlias(String col, Table table, Joins joins)
boolean isAggregate()
void setAggregate(boolean agg)
boolean isLob()
void setLob(boolean lob)
void clearSelects()
void selectPlaceholder(String sql)
boolean select(SQLBuffer sql, Object id)
Result
.boolean select(SQLBuffer sql, Object id, Joins joins)
Result
.boolean select(String sql, Object id)
Result
.boolean select(String sql, Object id, Joins joins)
Result
.boolean select(Column col)
int select(Column[] cols)
int select(Column[] cols, Joins joins)
void select(ClassMapping mapping, int subclasses, JDBCStore store, JDBCFetchConfiguration fetch, int eager)
void select(ClassMapping mapping, int subclasses, JDBCStore store, JDBCFetchConfiguration fetch, int eager, Joins joins)
boolean selectIdentifier(Column col)
count
.boolean selectIdentifier(Column col, Joins joins)
count
.int selectIdentifier(Column[] cols)
count
.int selectIdentifier(Column[] cols, Joins joins)
count
.void selectIdentifier(ClassMapping mapping, int subclasses, JDBCStore store, JDBCFetchConfiguration fetch, int eager)
count
.void selectIdentifier(ClassMapping mapping, int subclasses, JDBCStore store, JDBCFetchConfiguration fetch, int eager, Joins joins)
count
.int selectPrimaryKey(ClassMapping mapping)
int selectPrimaryKey(ClassMapping mapping, Joins joins)
void clearOrdering()
int orderByPrimaryKey(ClassMapping mapping, boolean asc, boolean sel)
int orderByPrimaryKey(ClassMapping mapping, boolean asc, Joins joins, boolean sel)
boolean orderBy(Column col, boolean asc, boolean sel)
boolean orderBy(Column col, boolean asc, Joins joins, boolean sel)
int orderBy(Column[] cols, boolean asc, boolean sel)
int orderBy(Column[] cols, boolean asc, Joins joins, boolean sel)
boolean orderBy(SQLBuffer sql, boolean asc, boolean sel, Value selAs)
boolean orderBy(SQLBuffer sql, boolean asc, Joins joins, boolean sel, Value selAs)
boolean orderBy(String sql, boolean asc, boolean sel)
boolean orderBy(String sql, boolean asc, Joins joins, boolean sel)
void wherePrimaryKey(Object oid, ClassMapping mapping, JDBCStore store)
void whereForeignKey(ForeignKey fk, Object oid, ClassMapping mapping, JDBCStore store)
void where(Joins joins)
void where(SQLBuffer sql)
void where(String sql)
void having(SQLBuffer sql)
void having(String sql)
void groupBy(Column col)
void groupBy(Column[] cols)
void groupBy(SQLBuffer sql)
void groupBy(String sql)
void groupBy(ClassMapping mapping, int subclasses, JDBCStore store, JDBCFetchConfiguration fetch)
void groupBy(ClassMapping mapping, int subclasses, JDBCStore store, JDBCFetchConfiguration fetch, Joins joins)
SelectExecutor whereClone(int sels)
sels
- number of selects to UNION together; ignored if <= 1SelectExecutor fullClone(int sels)
sels
- number of selects to UNION together; ignored if <= 1SelectExecutor eagerClone(FieldMapping key, int eagerType, boolean toMany, int sels)
key
- the key for the eager selecteagerType
- one of the EAGER_* constantstoMany
- whether the eager join is to-manysels
- number of selects to UNION together; ignored if <= 1SelectExecutor getEager(FieldMapping key)
Joins newJoins()
Joins newOuterJoins()
Joins and(Joins joins1, Joins joins2)
Joins or(Joins joins1, Joins joins2)
String toString()
String getColumnAlias(Column col, Object path)
void setContext(Context context)
context
- Context ctx()
void setSchemaAlias(String schemaAlias)
schemaAlias
- void setHasSubselect(boolean hasSub)
boolean getHasSubselect()
void logEagerRelations()
void setTablePerClassMeta(ClassMapping meta)
ClassMapping getTablePerClassMeta()
void setJoinedTableClassMeta(List meta)
List getJoinedTableClassMeta()
void setExcludedJoinedTableClassMeta(List meta)
List getExcludedJoinedTableClassMeta()
DBDictionary getDictionary()
Copyright © 2006–2020 Apache Software Foundation. All rights reserved.