Querydsl Reference Documentation

Type-safe SQL-like queries for Java.

Get Started with JPA View on GitHub


Querydsl is a framework that enables the construction of statically typed SQL-like queries for multiple backends in Java. Instead of writing queries as inline strings or externalizing them into XML files, you construct them via a fluent API.

Benefits

  • Code completion in your IDE — discover available columns and operations as you type.
  • Syntactically valid queries — the compiler catches most query mistakes before runtime.
  • Safe domain references — properties are referenced through generated types, not strings.
  • Refactoring friendly — rename a field and every query that uses it updates automatically.

Supported Backends

Module Artifact
JPA (Hibernate / EclipseLink) io.github.openfeign.querydsl:querydsl-jpa
SQL (JDBC) io.github.openfeign.querydsl:querydsl-sql
R2DBC (Reactive SQL) io.github.openfeign.querydsl:querydsl-r2dbc
MongoDB io.github.openfeign.querydsl:querydsl-mongodb
Collections io.github.openfeign.querydsl:querydsl-collections
Spatial io.github.openfeign.querydsl:querydsl-sql-spatial
Kotlin Extensions io.github.openfeign.querydsl:querydsl-kotlin
Scala Extensions io.github.openfeign.querydsl:querydsl-scala

Quick Example

QCustomer customer = QCustomer.customer;
List<Customer> bobs = queryFactory.selectFrom(customer)
    .where(customer.firstName.eq("Bob"))
    .orderBy(customer.lastName.asc())
    .fetch();

Current Version

The latest release is 7.1. Add it to your Maven project:

<dependency>
  <groupId>io.github.openfeign.querydsl</groupId>
  <artifactId>querydsl-jpa</artifactId>
  <version>7.1</version>
</dependency>

See the Migration Guide if you are upgrading from the original com.querydsl artifacts.