9.9 Database operations based on the query language
To use the JPA for operating the database data, implement the operation through the javax.persistence.Query interface. Using the javax.persistence.Query interface enables you to execute operations, such as search, update, and delete, for multiple records at the same time. To use the javax.persistence.Query interface, the user uses the query language to operate the database.
With Cosminexus JPA Provider, you can use JPQL and SQL as the query language. A description of JPQL and SQL is as follows:
-
JPQL
JPQL is a query language defined in the JPA specifications. This language does not depend on the database and operates for the entity class.
-
SQL
SQL is a database-dependent query language. SQL is also called a native query. This language operates for the database data.
For details on the database operations based on JPQL and SQL, see 9.16 Procedure for referencing and updating the database with the query language. Furthermore, for details on the JPQL syntax, see 9.17 JPQL coding method.