public class GenericSelectQuery<T> extends GenericBaseQuery<T> implements SelectQuery<T>
builder, primitiveToBoxPath, primitiveToBoxType, primitiveToBoxValue, target, targetClass, unproxable
Constructor and Description |
---|
GenericSelectQuery(Class<T> targetClass) |
GenericSelectQuery(InternalQueryBuilder builder,
Class<T> targetClass) |
Modifier and Type | Method and Description |
---|---|
List<Join> |
getJoins() |
HavingCondition |
having(Object projection,
ProjectionType type)
Declare an having condition on projection.
|
boolean |
isSubQuery() |
<J> J |
join(Class<J> joinClass)
Create a join object with the specified type
Example:
SelectQuery<Person> query = ... |
<J> J |
join(Class<J> joinClass,
JoinType type)
Create a join object with the specified type and specific join operator
Example:
SelectQuery<Person> query = ... |
<J> J |
join(J joinPath,
Class<J> joinClass)
Create a join object with the specified type, on the specified base path
Example:
SelectQuery<Person> query = ... |
<J> J |
join(J joinPath,
Class<J> joinClass,
JoinType type)
Create a join object with the specified type, on the specified base path
and join operator
Example:
SelectQuery<Person> query = ... |
void |
order(Object order)
Add an order condition to query.
|
void |
order(Object order,
OrderType type)
Add an order to query.
|
void |
order(Object order,
ProjectionType projectionType,
OrderType type)
Add an order to query.
|
void |
prj(Object projection)
Add a projection to query.
|
void |
prj(Object projection,
ProjectionType type)
Add a projection to query with an operator.
|
<S> SelectQuery<S> |
subQuery(Class<S> targetClass)
Create a new Sub Query of current query.
|
box, box, box, box, box, box, box, box, box, clear, extractItem, getBuilder, getRootPathItem, getTargetClass, proxy, target
and, between, condition, contains, contains, eq, eq, gt, gt, gtEq, gtEq, in, in, like, likeNc, lt, lt, ltEq, ltEq, notContains, notContains, notEq, notEq, notIn, notIn, notLike, notLikeNc, or
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public GenericSelectQuery(InternalQueryBuilder builder, Class<T> targetClass)
public void prj(Object projection)
SelectQuery
SelectQuery<Person> query = ....
query.prj(query.target().getName());
prj
in interface SelectQuery<T>
projection
- the projection object to add.public void prj(Object projection, ProjectionType type)
SelectQuery
SelectQuery<Person> query = ....
query.prj(query.target().getSurname(),ProjectionType.COUNT);
prj
in interface SelectQuery<T>
projection
- the projection object to add.type
- the type of projection to add.public void order(Object order)
SelectQuery
SelectQuery<Person> query = ....
query.order(query.target().getName());
order
in interface SelectQuery<T>
order
- the order to add.public void order(Object order, OrderType type)
SelectQuery
SelectQuery<Person> query = ....
query.order(query.target().getName(),OrderType.DESC);
order
in interface SelectQuery<T>
order
- the order to add.type
- the type of order.public void order(Object order, ProjectionType projectionType, OrderType type)
SelectQuery
SelectQuery<Person> query = ....
query.order(query.target().getSurname(),ProjectionType.COUNT,OrderType.DESC);
order
in interface SelectQuery<T>
order
- the order to add.projectionType
- the tipe of projection for grouping actions in order.type
- the type of order.public HavingCondition having(Object projection, ProjectionType type)
SelectQuery
SelectQuery<Person> query = ....
query.having(query.target().getSurname(),ProjectionType.COUNT).gt(20);
having
in interface SelectQuery<T>
projection
- target of condition.type
- grouping operationpublic boolean isSubQuery()
public <S> SelectQuery<S> subQuery(Class<S> targetClass)
SelectQuery
SelectQuery<:Person> query = ....
SelectQuery<Home> queryHomes = query.subQuery(Home.class);
....
query.in(query.target().getHome(),queryHomes);
subQuery
in interface SelectQuery<T>
targetClass
- class target of sub query.public <J> J join(Class<J> joinClass)
SelectQuery
SelectQuery<Person> query = ...
Home home = query.join(Home.class);
query.eq(query.target().getAddress(),home.getAddress());
join
in interface SelectQuery<T>
joinClass
- the type of the join object.public <J> J join(Class<J> joinClass, JoinType type)
SelectQuery
SelectQuery<Person> query = ...
Home home = query.join(Home.class,JoinType.LEFT);
query.eq(query.target().getAddress(),home.getAddress());
join
in interface SelectQuery<T>
joinClass
- the type of the join object.type
- the join operator type.public <J> J join(J joinPath, Class<J> joinClass)
SelectQuery
SelectQuery<Person> query = ...
Company company = query.join(target.getCompany(),Company.class);
query.eq(query.target().getAddress(),company.getAddress());
join
in interface SelectQuery<T>
joinPath
- the path to reach the base object.joinClass
- the type of the join object.public <J> J join(J joinPath, Class<J> joinClass, JoinType type)
SelectQuery
SelectQuery<Person> query = ...
Company company = query.join(target.getCompany(),Company.class,JoinType.LEFT);
query.eq(query.target().getAddress(),company.getAddress());
join
in interface SelectQuery<T>
joinPath
- the path to reach the base object.joinClass
- the type of the join object.type
- the join operator type.Copyright © 2014 Object Query. All rights reserved.