I've used JPA Criteria for many years. The main advantage is its type-safe approach (compared to JPQL), but the code is quite complicated and not always straightforward. Recently, I came across a Querydsl framework and I saw its benefits immediately. The main benefits for me are:
- Type-safe approach.
- Fluent API with SQL style - the code looks pretty much like SQL queries.
- No limitation to JPA technology - there are modules for other technologies.
The idea of this series is to shed light on the Querydsl framework and compare it with the JPA Criteria. The main goal is to demonstrate the differences in some standard cases. This series is planned to have these parts: