Quarkus Qubit

Type-safe, lambda-based queries on Panache entities with build-time transformation to JPA Criteria Queries.

What is Qubit?

Qubit analyzes lambda expressions at build time and transforms them into JPA Criteria Queries. This approach combines the readability of streams with the performance of pre-compiled queries.

List<Person> adults = personRepository
    .where((Person p) -> p.age >= 18 && p.active)
    .sortedBy((Person p) -> p.lastName)
    .toList();

Key Features

  • Type-safe: Full IDE support with compile-time verification

  • Near-zero overhead: Queries are pre-compiled at build time. Runtime overhead is <1% of total query cost — Hibernate ORM dominates execution time.

  • Fluent API: JINQ-inspired method chaining for readable queries

Performance

Qubit adds negligible runtime overhead to JPA queries:

Layer Share of query cost

Hibernate ORM (SQM, SQL generation, entity tracking)

~68%

Entity hydration + JDBC

~29%

Qubit runtime (call site resolution, captured variable extraction)

<1%

All lambda analysis and query executor generation happens at build time — the runtime path is a direct call to pre-compiled JPA Criteria API code. Captured variables use JPA bind parameters, enabling database prepared statement plan caching.

Capabilities

Feature Description

Query Operations

Filtering, sorting, pagination, and projections

Join Queries

Inner and left joins with access to both entities

Grouping & Aggregations

GROUP BY with HAVING clauses and aggregate functions

Subqueries

EXISTS, IN, and scalar comparisons with subqueries

Configuration

Scanning, code generation, and logging options

Installation

Add the dependency to your project:

<dependency>
    <groupId>io.quarkiverse.qubit</groupId>
    <artifactId>quarkus-qubit</artifactId>
    <version>${quarkus-qubit.version}</version>
</dependency>

Requirements

  • Java 25+

  • Quarkus 3.31+

  • Hibernate ORM with Panache

  • GraalVM 25+ (optional, for native compilation)

Where to Go Next