re1 / jacq-javaee

https://development.senegate.at/confluence/display/JACQ
0 stars 0 forks source link

Use JPA Metamodels for building SQL queries #20

Open re1 opened 4 years ago

re1 commented 4 years ago

SQL queries are currently using the EntityManager with string-based Java Persistence Query Language (JPQL) queries. It might be a good idea to use the CriteriaQueries in combination with metamodels.

The article Dynamic, typesafe queries in JPA 2.0 by IBM explains this approach in detail.

The generation of metamodels requires an additional dependency, which might not be a problem as Hibernate supports metamodel generation and the WildFly application server includes Hibernate ORM as the default JPA provider.

Alternatively metamodels could also be generated manually.