liveBook · Manning

PanacheEntityResource

As explained in Quarkus in Action

PanacheEntityResource is a Quarkus REST Data interface for exposing CRUD operations on an entity using the active record model.

PanacheEntityResource is a Quarkus REST Data interface for exposing CRUD operations on a Panache entity through the active record model. Quarkus generates the corresponding JAX-RS resource during the build. section 7.4

Use it by:

  • Adding the quarkus-hibernate-orm-rest-data-panache extension, alongside the JDBC driver and REST JSON serialization extension when needed. section 7.4
  • Declaring an interface that extends PanacheEntityResource<Entity, Id>, supplying the entity class and identifier type. section 7.4
  • Customizing inherited operations with REST Data annotations when the generated defaults require adjustment. section 7.4

Expose Reservation CRUD operations

interface ReservationCrudResource extends PanacheEntityResource<Reservation, Long> { }

Customize the resource path

@ResourceProperties(path = "/admin/reservation") interface ReservationCrudResource extends PanacheEntityResource<Reservation, Long> { }

How Quarkus in Action covers it

How deep it goes
Defines type parameters, build-time generation, and customization points but defers individual operation declarations to the parent interface.
Examples
Demonstrates ReservationCrudResource, Reservation and Long, a custom root path, an extension command, and Swagger UI.
What it assumes
Assumes a Panache entity using the active record pattern and requires REST Data, persistence, database-driver, and JSON extensions.
What you can do after
Build CRUD endpoints by declaring a typed interface and optionally customizing its generated resource path.
How it connects
Connects active record, Panache entities, JAX-RS resources, REST Data, and build-time code generation.

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.