A JPQL statement includes the SELECT statement, UPDATE statement, and DELETE statement.
You can dynamically specify a JPQL statement or statically define a JPQL statement using the annotation and O/R mapping file tags. You can also specify parameters in all the JPQL statements.
JPQL is a typed language and all the expressions have a type. The abstract schema type defined in the expression configuration and the identification variable, the type for evaluating the persistence fields and relationships, and the literal type configure the expression types. For details on the syntax, see Appendix D BNF for JPQL.
With JPQL, a query is issued for an entity. Therefore, the abstract schema of the target entity must be defined with the query. The abstract schema type of the entity is defined based on the entity class and O/R mapping information provided by the annotations or the O/R mapping file.
The abstract schema type indicates an entity class. The fields and the O/R mapping information of the annotation configure the entity class.
The abstract schema type of the entity has the following fields:
With JPQL, you must specify the abstract schema type in order to indicate an entity. The name used for indicating the abstract schema type is called the abstract schema name. You define the abstract schema name in the name attribute of @Entity (or in the name attribute of the entity tag in the O/R mapping file). If the name attribute is not specified, the name becomes the class name of the entity class (without package name).
The abstract schema name is specific to each persistence unit.
The query domain can reference the abstract schema type of all the entities defined in the persistence unit. The abstract schema type of the other related entities can be referenced using the relation field defined in the abstract schema type.