Querydsl vs. JPA Criteria, Part 2: Metamodel

Featured Imgs 23

This is the second article in my series dedicated to the Querydsl framework. I planned to shed light on the custom queries, as promised in the first article, but I decided to explain the metamodel usage first in order to simplify the explanation later on.

So far, this series contains these articles:

Querydsl vs. JPA Criteria – Introduction

Featured Imgs 23

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: