Class QueryType<X,C extends CommonAbstractCriteria,C2 extends C,Q extends Query>
java.lang.Object
org.dellroad.querystream.jpa.querytype.QueryType<X,C,C2,Q>
- Type Parameters:
X
- query result/target typeC
- configured criteria API query typeC2
- final criteria API query typeQ
- final JPA query type
- Direct Known Subclasses:
DeleteType
,SearchType
,UpdateType
public abstract class QueryType<X,C extends CommonAbstractCriteria,C2 extends C,Q extends Query>
extends Object
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract C2
createCriteriaQuery
(CriteriaBuilder builder) Create a new Criteria API query object of the appropriate type.abstract Q
createQuery
(EntityManager entityManager, C2 query) Create a JPA query object of the appropriate type.getType()
Get the query result/target type associated with this instance.abstract void
where
(C query, Expression<Boolean> restriction) Configure the restriction associated with the given query.abstract void
Configure the restriction associated with the given query.
-
Field Details
-
type
-
-
Constructor Details
-
QueryType
Constructor.- Parameters:
type
- query result/target type- Throws:
IllegalArgumentException
- iftype
is null
-
-
Method Details
-
getType
Get the query result/target type associated with this instance.- Returns:
- query result/target type
-
createCriteriaQuery
Create a new Criteria API query object of the appropriate type.- Parameters:
builder
- criteria builder- Returns:
- new criteria query object
- Throws:
IllegalArgumentException
- ifbuilder
is null
-
createQuery
Create a JPA query object of the appropriate type.- Parameters:
entityManager
- JPA entity managerquery
- criteria query object- Returns:
- new executable JPA query object
- Throws:
IllegalArgumentException
- ifentityManager
orquery
is null
-
where
Configure the restriction associated with the given query.- Parameters:
query
- criteria query objectrestriction
- query restriction- Throws:
IllegalArgumentException
- ifquery
orexpression
is null
-
where
Configure the restriction associated with the given query.- Parameters:
query
- criteria query objectrestriction
- query restriction- Throws:
IllegalArgumentException
- ifquery
orexpression
is null
-