Code Shrinking with Quarkus and Panache ORM

With Panache ORM and Quarkus a JSON-B / JPA entity:

package workshops;

import java.time.LocalDate;
import javax.persistence.Entity;
import io.quarkus.hibernate.orm.panache.PanacheEntity;

public class Workshop extends PanacheEntity{

    public String name;
    public LocalDate date;
can be directly exposed via a JAX-RS resource:

package workshops;

import java.util.List;

import javax.transaction.Transactional;

public class WorkshopsResource {

    public List<Workshop> workshops() {
        return Workshop.listAll();

    public void save(Workshop workshop) {

without any direct reference to an EntityManager or declaration of persistence.xml.

The data source is configured via MicroProfile configuration:

quarkus.datasource.url = jdbc:postgresql://localhost:5432/postgres
quarkus.datasource.driver = org.postgresql.Driver
quarkus.datasource.username = airhacks
quarkus.datasource.password = airhacks
quarkus.hibernate-orm.database.generation = drop-and-create
See it in action (and from scratch):

See you at Web, MicroProfile and Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home:


Panache: Flair, Style :-)

Posted by John Clingan on October 22, 2019 at 01:58 PM CEST #

Knowing some quarkus developers :-), I thought Panache was meant as defined here:é

Posted by Adam Bien on October 22, 2019 at 05:10 PM CEST #

It looks line Panache Is Hibernate combined with the Active Record pattern.

Posted by Danilo Piazzalunga on November 05, 2019 at 09:00 AM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
...the last 150 posts
...the last 10 comments