Hibernate Reactive
Explore how to implement Hibernate Reactive in Quarkus to enable non-blocking database operations. Learn to add necessary dependencies, use the reactive API with PostgreSQL, and simplify development with Panache using active record and repository patterns. Gain practical skills to build responsive reactive applications.
Hibernate Reactive is the reactive API for the Hibernate ORM. It adds support for non-blocking database drivers to enable a reactive style of interaction with the database.
Adding the extensions
To use the Hibernate Reactive extension, we need to add a couple of dependencies, the first being the extension itself, called quarkus-hibernate-reactive. The second dependency is the reactive JDBC driver for the chosen database. Quarkus offers a list of extensions to handle different types of databases, which include:
quarkus-reactive-mysql-clientused for MySQL.quarkus-reactive-oracle-clientused for Oracle Database.quarkus-reactive-pg-clientused for PostgreSQL.
Note: In the rest of the course, we’ll use PostgreSQL as the reactive SQL database.
After adding the dependencies, we should have the below new lines in our pom.xml (or build.gradle) file.
Using Hibernate Reactive
Using the Reactive Hibernate API is ...