Interface DeclaredQuery
- All Superinterfaces:
QueryProvider
- All Known Implementing Classes:
PreprocessedQuery
Interface defining the contract to represent a declared query.
Declared queries consist of a query string and a flag whether the query is a native (SQL) one or a JPQL query.
Queries can be rewritten to contain a different query string (i.e. count query derivation, sorting, projection
updates) while retaining their native flag.
- Since:
- 2.0.3
- Author:
- Jens Schauder, Diego Krupitza, Mark Paluch
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanisJpql()Return whether the query is a JPQL query of not.booleanisNative()Return whether the query is a native query of not.static DeclaredQueryCreates a DeclaredQuery for a JPQL query.static DeclaredQuerynativeQuery(String sql) Creates a DeclaredQuery for a native query.default DeclaredQueryRewrite a query string using a new query string retaining its source andnativeflag.Methods inherited from interface QueryProvider
getQueryString
-
Method Details
-
jpqlQuery
Creates a DeclaredQuery for a JPQL query.- Parameters:
jpql- the JPQL query string.- Returns:
- new instance of
DeclaredQuery.
-
nativeQuery
Creates a DeclaredQuery for a native query.- Parameters:
sql- the native query string.- Returns:
- new instance of
DeclaredQuery.
-
isNative
boolean isNative()Return whether the query is a native query of not.- Returns:
- true if native query; false if it is a JPQL query.
-
isJpql
default boolean isJpql()Return whether the query is a JPQL query of not.- Returns:
- true if JPQL query; false if it is a native query.
- Since:
- 4.0
-
rewrite
Rewrite a query string using a new query string retaining its source andnativeflag.- Parameters:
newQueryString- the new query string.- Returns:
- the rewritten
DeclaredQuery. - Since:
- 4.0
-