T
- result typeQ
- concrete subtypepublic abstract class ProjectableSQLQuery<T,Q extends ProjectableSQLQuery<T,Q> & Query<Q>> extends FetchableSubQueryBase<T,Q> implements SQLCommonQuery<Q>, FetchableQuery<T,Q>
ProjectableSQLQuery
is the base type for SQL query implementationsModifier and Type | Field and Description |
---|---|
protected Configuration |
configuration |
protected SubQueryExpression<?> |
firstUnionSubQuery |
protected Expression<?> |
union |
protected boolean |
unionAll |
MDC_PARAMETERS, MDC_QUERY, queryMixin
Constructor and Description |
---|
ProjectableSQLQuery(QueryMixin<Q> queryMixin,
Configuration configuration) |
Modifier and Type | Method and Description |
---|---|
<R,C> R |
accept(Visitor<R,C> v,
C context)
Accept the visitor with the given context
|
Q |
addFlag(QueryFlag.Position position,
Expression<?> flag)
Add the given Expression as a query flag
|
Q |
addFlag(QueryFlag.Position position,
String flag)
Add the given String literal as query flag
|
Q |
addFlag(QueryFlag.Position position,
String prefix,
Expression<?> expr)
Add the given prefix and expression as a general query flag
|
Q |
addFlag(QueryFlag flag)
Add the given query flag
|
Q |
addJoinFlag(String flag)
Add the given String literal as a join flag to the last added join with the position
BEFORE_TARGET
|
Q |
addJoinFlag(String flag,
JoinFlag.Position position)
Add the given String literal as a join flag to the last added join
|
abstract Q |
clone() |
protected void |
clone(Q query) |
protected abstract SQLSerializer |
createSerializer() |
long |
fetchCount()
Get the count of matched elements
|
T |
fetchOne()
Get the projection as a unique result or null if no result is found
|
Q |
from(Expression<?>... args)
Defines the sources of the query
|
Q |
from(Expression<?> arg) |
Q |
from(SubQueryExpression<?> subQuery,
Path<?> alias)
Adds a sub query source
|
Q |
fullJoin(EntityPath<?> target)
Adds a full join to the given target
|
<E> Q |
fullJoin(EntityPath<E> target,
Path<E> alias)
Adds a full join to the given target
|
<E> Q |
fullJoin(ForeignKey<E> key,
RelationalPath<E> entity)
Adds a full join to the given target
|
<E> Q |
fullJoin(RelationalFunctionCall<E> target,
Path<E> alias)
Adds a full join to the given target
|
Q |
fullJoin(SubQueryExpression<?> target,
Path<?> alias)
Adds a full join to the given target
|
SQLBindings |
getSQL()
Get the query as an SQL query string and bindings
|
Q |
innerJoin(EntityPath<?> target)
Adds an inner join to the given target
|
<E> Q |
innerJoin(EntityPath<E> target,
Path<E> alias)
Adds an inner join to the given target
|
<E> Q |
innerJoin(ForeignKey<E> key,
RelationalPath<E> entity)
Adds an inner join to the given target
|
<E> Q |
innerJoin(RelationalFunctionCall<E> target,
Path<E> alias)
Adds a inner join to the given target
|
Q |
innerJoin(SubQueryExpression<?> target,
Path<?> alias)
Adds an inner join to the given target
|
Q |
join(EntityPath<?> target)
Adds a join to the given target
|
<E> Q |
join(EntityPath<E> target,
Path<E> alias)
Adds a join to the given target
|
<E> Q |
join(ForeignKey<E> key,
RelationalPath<E> entity)
Adds a join to the given target
|
<E> Q |
join(RelationalFunctionCall<E> target,
Path<E> alias)
Adds a join to the given target
|
Q |
join(SubQueryExpression<?> target,
Path<?> alias)
Adds a join to the given target
|
Q |
leftJoin(EntityPath<?> target)
Adds a left join to the given target
|
<E> Q |
leftJoin(EntityPath<E> target,
Path<E> alias)
Adds a left join to the given target
|
<E> Q |
leftJoin(ForeignKey<E> key,
RelationalPath<E> entity)
Adds a left join to the given target
|
<E> Q |
leftJoin(RelationalFunctionCall<E> target,
Path<E> alias)
Adds a left join to the given target
|
Q |
leftJoin(SubQueryExpression<?> target,
Path<?> alias)
Adds a left join to the given target
|
Q |
on(Predicate... conditions)
Defines a filter to the last added join
|
Q |
on(Predicate condition) |
Q |
rightJoin(EntityPath<?> target)
Adds a right join to the given target
|
<E> Q |
rightJoin(EntityPath<E> target,
Path<E> alias)
Adds a right join to the given target
|
<E> Q |
rightJoin(ForeignKey<E> key,
RelationalPath<E> entity)
Adds a right join to the given target
|
<E> Q |
rightJoin(RelationalFunctionCall<E> target,
Path<E> alias)
Adds a full join to the given target
|
Q |
rightJoin(SubQueryExpression<?> target,
Path<?> alias)
Adds a right join to the given target
|
protected SQLSerializer |
serialize(boolean forCountRow) |
String |
toString() |
<RT> Union<RT> |
union(List<SubQueryExpression<RT>> sq)
Creates an union expression for the given subqueries
|
<RT> Q |
union(Path<?> alias,
SubQueryExpression<RT>... sq)
Creates an union expression for the given subqueries
|
<RT> Union<RT> |
union(SubQueryExpression<RT>... sq)
Creates an union expression for the given subqueries
|
<RT> Union<RT> |
unionAll(List<SubQueryExpression<RT>> sq)
Creates an union expression for the given subqueries
|
<RT> Q |
unionAll(Path<?> alias,
SubQueryExpression<RT>... sq)
Creates an union expression for the given subqueries
|
<RT> Union<RT> |
unionAll(SubQueryExpression<RT>... sq)
Creates an union expression for the given subqueries
|
Q |
with(Path<?> alias,
Expression<?> query)
Adds a common table expression
|
WithBuilder<Q> |
with(Path<?> alias,
Path<?>... columns)
Adds a common table expression
|
Q |
with(Path<?> alias,
SubQueryExpression<?> query)
Adds a common table expression
|
Q |
withRecursive(Path<?> alias,
Expression<?> query)
Adds a common table expression
|
WithBuilder<Q> |
withRecursive(Path<?> alias,
Path<?>... columns)
Adds a common table expression
|
Q |
withRecursive(Path<?> alias,
SubQueryExpression<?> query)
Adds a common table expression
|
contains, contains, eq, eq, exists, getMetadata, getType, goe, goe, gt, gt, hashCode, in, in, isNotNull, isNull, loe, loe, lt, lt, ne, ne, notExists
equals, fetch, fetchFirst, transform, uniqueResult
distinct, groupBy, groupBy, having, having, limit, offset, orderBy, orderBy, restrict, set, where, where
finalize, getClass, notify, notifyAll, wait, wait, wait
distinct, limit, offset, orderBy, restrict, set
where
select, select, transform
fetch, fetchFirst, fetchResults, iterate
protected final Configuration configuration
@Nullable protected Expression<?> union
protected SubQueryExpression<?> firstUnionSubQuery
protected boolean unionAll
public ProjectableSQLQuery(QueryMixin<Q> queryMixin, Configuration configuration)
public <R,C> R accept(Visitor<R,C> v, @Nullable C context)
Expression
accept
in interface Expression<T>
accept
in class FetchableSubQueryBase<T,Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
R
- return typeC
- context typev
- visitorcontext
- context of visitpublic Q addJoinFlag(String flag)
addJoinFlag
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
flag
- join flagpublic Q addJoinFlag(String flag, JoinFlag.Position position)
addJoinFlag
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
flag
- join flagposition
- positionpublic Q addFlag(QueryFlag.Position position, String prefix, Expression<?> expr)
addFlag
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
position
- position of the flagprefix
- prefix for the flagexpr
- expression of the flagpublic Q addFlag(QueryFlag flag)
flag
- query flagpublic Q addFlag(QueryFlag.Position position, String flag)
addFlag
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
position
- positionflag
- query flagpublic Q addFlag(QueryFlag.Position position, Expression<?> flag)
addFlag
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
position
- positionflag
- query flagpublic long fetchCount()
Fetchable
fetchCount
in interface Fetchable<T>
public Q from(Expression<?> arg)
public Q from(Expression<?>... args)
SQLCommonQuery
from
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
args
- frompublic Q from(SubQueryExpression<?> subQuery, Path<?> alias)
SQLCommonQuery
from
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
subQuery
- sub queryalias
- aliaspublic Q fullJoin(EntityPath<?> target)
SQLCommonQuery
fullJoin
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
target
- full join targetpublic <E> Q fullJoin(EntityPath<E> target, Path<E> alias)
SQLCommonQuery
fullJoin
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
target
- full join targetalias
- aliaspublic <E> Q fullJoin(RelationalFunctionCall<E> target, Path<E> alias)
SQLCommonQuery
fullJoin
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
target
- full join targetalias
- aliaspublic Q fullJoin(SubQueryExpression<?> target, Path<?> alias)
SQLCommonQuery
fullJoin
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
target
- subqueryalias
- aliaspublic <E> Q fullJoin(ForeignKey<E> key, RelationalPath<E> entity)
SQLCommonQuery
fullJoin
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
key
- foreign key for joinentity
- join targetpublic Q innerJoin(EntityPath<?> target)
SQLCommonQuery
innerJoin
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
public <E> Q innerJoin(EntityPath<E> target, Path<E> alias)
SQLCommonQuery
innerJoin
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
target
- inner join targetalias
- aliaspublic <E> Q innerJoin(RelationalFunctionCall<E> target, Path<E> alias)
SQLCommonQuery
innerJoin
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
target
- relational function callalias
- aliaspublic Q innerJoin(SubQueryExpression<?> target, Path<?> alias)
SQLCommonQuery
innerJoin
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
target
- subqueryalias
- aliaspublic <E> Q innerJoin(ForeignKey<E> key, RelationalPath<E> entity)
SQLCommonQuery
innerJoin
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
key
- foreign key to use for joinentity
- join targetpublic Q join(EntityPath<?> target)
SQLCommonQuery
join
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
target
- join targetpublic <E> Q join(EntityPath<E> target, Path<E> alias)
SQLCommonQuery
join
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
target
- join targetalias
- aliaspublic <E> Q join(RelationalFunctionCall<E> target, Path<E> alias)
SQLCommonQuery
join
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
target
- join targetalias
- aliaspublic Q join(SubQueryExpression<?> target, Path<?> alias)
SQLCommonQuery
join
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
target
- subqueryalias
- aliaspublic <E> Q join(ForeignKey<E> key, RelationalPath<E> entity)
SQLCommonQuery
join
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
key
- foreign key to use for joinentity
- join targetpublic Q leftJoin(EntityPath<?> target)
SQLCommonQuery
leftJoin
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
target
- join targetpublic <E> Q leftJoin(EntityPath<E> target, Path<E> alias)
SQLCommonQuery
leftJoin
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
target
- left join targetalias
- aliaspublic <E> Q leftJoin(RelationalFunctionCall<E> target, Path<E> alias)
SQLCommonQuery
leftJoin
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
target
- relational function callalias
- aliaspublic Q leftJoin(SubQueryExpression<?> target, Path<?> alias)
SQLCommonQuery
leftJoin
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
target
- subqueryalias
- aliaspublic <E> Q leftJoin(ForeignKey<E> key, RelationalPath<E> entity)
SQLCommonQuery
leftJoin
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
key
- foreign key to use for joinentity
- join targetpublic Q rightJoin(EntityPath<?> target)
SQLCommonQuery
rightJoin
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
target
- join targetpublic <E> Q rightJoin(EntityPath<E> target, Path<E> alias)
SQLCommonQuery
rightJoin
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
target
- right join targetalias
- aliaspublic <E> Q rightJoin(RelationalFunctionCall<E> target, Path<E> alias)
SQLCommonQuery
rightJoin
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
target
- relational function callalias
- aliaspublic Q rightJoin(SubQueryExpression<?> target, Path<?> alias)
SQLCommonQuery
rightJoin
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
target
- subqueryalias
- aliaspublic <E> Q rightJoin(ForeignKey<E> key, RelationalPath<E> entity)
SQLCommonQuery
rightJoin
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
key
- foreign key to use for joinentity
- join targetpublic Q on(Predicate... conditions)
SQLCommonQuery
on
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
conditions
- join conditionspublic <RT> Union<RT> union(SubQueryExpression<RT>... sq)
RT
- sq
- subqueriespublic <RT> Union<RT> union(List<SubQueryExpression<RT>> sq)
RT
- sq
- subqueriespublic <RT> Q union(Path<?> alias, SubQueryExpression<RT>... sq)
RT
- alias
- alias for unionsq
- subqueriespublic <RT> Union<RT> unionAll(SubQueryExpression<RT>... sq)
RT
- sq
- subqueriespublic <RT> Union<RT> unionAll(List<SubQueryExpression<RT>> sq)
RT
- sq
- subqueriespublic <RT> Q unionAll(Path<?> alias, SubQueryExpression<RT>... sq)
RT
- alias
- alias for unionsq
- subqueriespublic T fetchOne()
Fetchable
public Q withRecursive(Path<?> alias, SubQueryExpression<?> query)
SQLCommonQuery
Usage
query.withRecursive(alias, subQuery) .from(...)
withRecursive
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
alias
- alias for queryquery
- subquerypublic Q withRecursive(Path<?> alias, Expression<?> query)
SQLCommonQuery
Usage
query.withRecursive(alias, subQuery) .from(...)
withRecursive
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
alias
- alias for queryquery
- subquerypublic WithBuilder<Q> withRecursive(Path<?> alias, Path<?>... columns)
SQLCommonQuery
Usage
query.withRecursive(alias, columns...).as(subQuery) .from(...)
withRecursive
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
alias
- alias for querycolumns
- columns to usepublic Q with(Path<?> alias, SubQueryExpression<?> query)
SQLCommonQuery
Usage
query.with(alias, subQuery) .from(...)
with
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
alias
- alias for queryquery
- subquerypublic Q with(Path<?> alias, Expression<?> query)
SQLCommonQuery
Usage
query.with(alias, subQuery) .from(...)
with
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
alias
- alias for queryquery
- subquerypublic WithBuilder<Q> with(Path<?> alias, Path<?>... columns)
SQLCommonQuery
Usage
query.with(alias, columns...).as(subQuery) .from(...)
with
in interface SQLCommonQuery<Q extends ProjectableSQLQuery<T,Q> & Query<Q>>
alias
- alias for querycolumns
- columns to useprotected void clone(Q query)
protected abstract SQLSerializer createSerializer()
protected SQLSerializer serialize(boolean forCountRow)
public SQLBindings getSQL()
Copyright © 2007–2016 Querydsl. All rights reserved.