Writing JPQL Queries with Spring Data
Queries created based on method name
The JPA, Java Persistence API, gives us a query language, Java Persistence Query Language, JPQL. Since JPQL queries use entity classes and attributes, JPA gives us a Query interface that uses EntityManager to create queries that interact with the database.
There are three methods available to implement JPQL queries that fetch instances based on non primary key attributes; Query based on method name, using the ‘@Query’ annotation, using the ‘@NamedQuery’ annotation. This post will…