Module org.dellroad.querystream.jpa
Class QueryType<X,C extends jakarta.persistence.criteria.CommonAbstractCriteria,C2 extends C,Q extends jakarta.persistence.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 jakarta.persistence.criteria.CommonAbstractCriteria,C2 extends C,Q extends jakarta.persistence.Query>
extends Object
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract C2createCriteriaQuery(jakarta.persistence.criteria.CriteriaBuilder builder) Create a new Criteria API query object of the appropriate type.abstract QcreateQuery(jakarta.persistence.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 voidConfigure the restriction associated with the given query.abstract voidConfigure the restriction associated with the given query.
-
Field Details
-
type
-
-
Constructor Details
-
QueryType
Constructor.- Parameters:
type- query result/target type- Throws:
IllegalArgumentException- iftypeis 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- ifbuilderis 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- ifentityManagerorqueryis null
-
where
Configure the restriction associated with the given query.- Parameters:
query- criteria query objectrestriction- query restriction- Throws:
IllegalArgumentException- ifqueryorexpressionis null
-
where
Configure the restriction associated with the given query.- Parameters:
query- criteria query objectrestriction- query restriction- Throws:
IllegalArgumentException- ifqueryorexpressionis null
-