Unified Queries for Java.
Querydsl is compact, safe
and easy to learn.

Modules

JPA

The popular choice for SQL persistence with a focus on CRUD and simple queries for object loading. more...

SQL

The alternative SQL abstraction with a focus on SQL operations and the full expressivity of the SQL standard. more...

Mongodb

ODM support via Morphia or Spring Data for MongoDB, the NoSQL of choice for many. more...

 

JDO

JDO support for Object, SQL and NoSQL storage abstraction. more...

Lucene

Full text indexing via Lucene, the most popular fulltext index for Java. more...

Collections

Java Collection querying for Java Beans and POJOs. more...

Documentation

Releases

Version selection

The downloads bundles are meant to be used if other build systems than Maven are used, such as Ant. All Querydsl releases are available via the public Maven repositories.

Examples

Basic query

JPAQuery query = new JPAQuery(entityManager);
List<Person> persons = query.from(person)
  .where(
    person.firstName.eq("John"),
    person.lastName.eq("Doe"))
  .list(person);
          

Order

List<Person> persons = query.from(person)
  .orderBy(person.lastName.asc(), 
           person.firstName.desc())
  .list(person);
          
 

Subqueries

List<Person> persons = query.from(person)
  .where(person.children.size().eq(
    new JPASubQuery().from(parent)
        .uniqueResult(parent.children.size().max())
  )).list(person);
          

Tuple projection

List<Tuple> tuples = query.from(person)
  .list(person.lastName,
        person.firstName,
        person.yearOfBirth);  
          

Community

Querydsl Group

Querydsl Group provides a free support forum and a place to discuss Querydsl design issues.

GitHub

GitHub is where Querydsl is hosted. Querydsl is licensed under the Apache 2.0 license

Twitter

Twitter is used for release announcements and links to articles on Querydsl
 

Community blog posts