Hibernate Reactive
Learn how to use a SQL database with Quarkus and Hibernate Reactive.
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-client
used for MySQL.quarkus-reactive-oracle-client
used for Oracle Database.quarkus-reactive-pg-client
used 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.
// Hibernate Reactive dependencyimplementation("io.quarkus:quarkus-hibernate-reactive")Reactive SQL client for PostgreSQLimplementation("io.quarkus:quarkus-reactive-pg-client")
Using Hibernate Reactive
Using ...