liveBook · Manning

Hibernate Reactive Panache

As explained in Quarkus in Action

quarkus-hibernate-reactive-panache is a Quarkus extension integrating Hibernate Reactive with Panache for reactive persistence.

Hibernate Reactive Panache combines Panache’s simplified data-access model with reactive programming and nonblocking SQL clients. Persistence results use Uni<E> or Uni<List<E>> rather than blocking entity or collection types, representing asynchronous computations that complete later. section 7.7.1

Adopting Hibernate Reactive Panache in a Quarkus service requires coordinated dependency, configuration, and model changes:

  • Replace quarkus-hibernate-orm-panache and quarkus-jdbc-postgresql with quarkus-hibernate-reactive-panache and quarkus-reactive-pg-client. section 7.7.1
  • Replace the blocking REST Data Panache extension with quarkus-hibernate-reactive-rest-data-panache when REST Data is used. section 7.7.1
  • Configure the reactive PostgreSQL URL, while retaining the other datasource properties and Hibernate database-generation setting. section 7.7.1
  • Change entity and resource imports to the reactive Panache packages; the entity structure otherwise remains the same. section 7.7.1

Nonblocking persistence endpoint

A JAX-RS method can return Uni<Reservation> directly. Calling persist() produces the asynchronous result, and onItem().call(...) chains work that continues after persistence completes. Quarkus can keep the I/O thread available while the database processes the insert. section 8.4.1

How Quarkus in Action covers it

How deep it goes
Explains dependency and import migration, reactive return types, configuration, and asynchronous execution without detailing reactive internals.
Examples
Demonstrates extension replacement, reactive datasource configuration, import changes, and a nonblocking Reservation persistence endpoint.
What it assumes
Assumes the Panache data-access model and introduces asynchronous Uni results before deeper reactive programming treatment.
What you can do after
Apply it via Quarkus extensions, reactive configuration, Panache entities, and Uni-returning REST persistence methods.
How it connects
Connects Panache with reactive programming, PostgreSQL, Mutiny, REST Data, and JAX-RS.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Quarkus in Action. The section links point to the parts of the book it draws on.