JPQL and @Modifying Queries
Learn JPQL and @Modifying Queries (Spring Data JPA, Spring Boot) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
JPQL: SQL Written Against Your Classes JPQL (Jakarta Persistence Query Language) looks like SQL, but it names entities and fields , not tables and columns. Hibernate translates it to the SQL of whichever database you use, so the same query runs on MySQL, PostgreSQL or H2. Use @Query on a repository method when the method name would be too long for a derived query, or when you need a join, aggregate or update.
More lessons in Spring Data JPA
- ORM, JPA and Hibernate
- Spring Data JPA
- Entity Mapping: @Entity, @Table, @Id, @Column
- Derived Query Methods - Fetch by Single & Multiple Fields
- Native Query with @Query
- Mapping - Real-World Scenarios
- Mapping - One-to-One & One-to-Many
- Mapping - Many-to-One & Many-to-Many
- Cascade Types and orphanRemoval
- Join Queries & DTO Projection
- JPA Advanced - Auditing, Locking & Specifications
- Mini Project: Student Repository with Spring Data JPA