Search⌘ K
AI Features

Quarkus Panache

Explore how to simplify database integration using Quarkus Panache. Understand the two main patterns—the active record and repository—used to manage entities and perform operations such as creating, fetching, and deleting data in Java applications.

Using the Hibernate ORM can be somewhat tricky and complex to work with, especially on simpler projects. That is why the Quarkus team worked on an extension to simplify the usage of Hibernate with Quarkus.

Configuration

To work with Panache we need to add the following extension, quarkus-hibernate-orm-panache, along with the JDBC driver extension. For the purpose of simplicity, we’ll use the H2 database, which will give us the below new lines in our pom.xml or build.gradle files.

XML
<!-- Hibernate ORM specific dependencies -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm-panache</artifactId>
</dependency>
<!-- JDBC driver dependencies -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jdbc-h2</artifactId>
</dependency>

Using Panache

When using the Quarkus Panache extension, we can pick one of the two available patterns: the active record pattern or the repository pattern.

Active record pattern

The active record pattern relies ...