public class JPQLQueryHelper
extends java.lang.Object
Constructor and Description |
---|
JPQLQueryHelper()
Creates a new
JPQLQueryHelper which uses the latest JPQL grammar. |
JPQLQueryHelper(JPQLGrammar jpqlGrammar)
Creates a new
JPQLQueryHelper . |
Modifier and Type | Method and Description |
---|---|
java.util.List<ClassDescriptor> |
getClassDescriptors(java.lang.CharSequence jpqlQuery,
AbstractSession session)
Retrieves the list of
descriptors corresponding to the entities used
throughout the given JPQL query. |
java.util.List<ConstructorQueryMappings> |
getConstructorQueryMappings(AbstractSession session)
Retrieves the class names and the attribute names mapped to their types that are used in the
constructor expressions defined in the
SELECT clause. |
ConstructorQueryMappings |
getConstructorQueryMappings(AbstractSession session,
DatabaseQuery query)
Retrieves the class names and the attribute names mapped to their types that are used in the
constructor expressions defined in the
SELECT clause. |
JPQLGrammar |
getGrammar()
Returns the JPQL grammar that will be used to define how to parse a JPQL query.
|
public JPQLQueryHelper()
JPQLQueryHelper
which uses the latest JPQL grammar.public JPQLQueryHelper(JPQLGrammar jpqlGrammar)
JPQLQueryHelper
.jpqlGrammar
- The JPQLGrammar
that will determine how to parse JPQL queriesjava.lang.NullPointerException
- The JPQLGrammar
cannot be null
public java.util.List<ClassDescriptor> getClassDescriptors(java.lang.CharSequence jpqlQuery, AbstractSession session)
descriptors
corresponding to the entities used
throughout the given JPQL query.jpqlQuery
- The JPQL query used to gather the descriptors defined in the declaration clausesession
- The AbstractSession
is used to retrieve the descriptorsdescriptors
used in the JPQL query or an empty
list if the JPQL query is invalid or incompletepublic java.util.List<ConstructorQueryMappings> getConstructorQueryMappings(AbstractSession session)
SELECT
clause.
For instance, from the following JPQL query:
SELECT new test.example.Employee(e.name, e.id),
new test.example.Address(a.zipcode)
FROM Employee e, Address a
The return object is
|- test.example.Employee
|- |- name : String
|- |- id : int
|- test.example.Address
|- zipcode : int
session
- The AbstractSession
is used to retrieve the mappings used in the
constructor itemspublic ConstructorQueryMappings getConstructorQueryMappings(AbstractSession session, DatabaseQuery query)
SELECT
clause.
For instance, from the following JPQL query:
SELECT new test.example.Address(a.streetName, a.zipcode)
FROM Address a
The return object is
test.example.Address
|- BasicMapping(streetName) : String
|- BasicMapping(zipcode) : int
session
- The AbstractSession
is used to retrieve the mappings used in the
constructor itemspublic JPQLGrammar getGrammar()
EclipseLink 2.6.3, "build v20160428-59c81c5" API Reference