REST Data automates the repeated work of exposing CRUD operations for database entities. In Quarkus, it generates customizable JAX-RS resources for Panache entities, making it practical to add a CRUD API to an existing service. section 7.4 section 7.9
Choose the extension according to the persistence approach:
- quarkus-hibernate-orm-rest-data-panache targets JDBC with Hibernate ORM and is the stable option identified here. section 7.4
- quarkus-mongodb-rest-data-panache targets MongoDB and is identified as experimental. section 7.4
- quarkus-hibernate-reactive-rest-data-panache targets reactive database drivers with Hibernate Reactive and is identified as experimental. section 7.4
For a relational database, add the REST Data extension together with a JDBC driver and REST JSON serialization support. Define an interface extending PanacheEntityResource with the entity type and identifier type; Quarkus then generates the resource. Customize its root path with ResourceProperties when the default path does not fit the application. section 7.4 section 7.4
Reservation CRUD resource
A Reservation service can declare `ReservationCrudResource extends PanacheEntityResource<Reservation, Long>`. Applying `@ResourceProperties(path = "/admin/reservation")` changes the generated resource root path. section 7.4
Listing 7.21 Adding REST Data extensions to the Reservation service
$ quarkus ext add quarkus-hibernate-orm-rest-data-panache \ quarkus-jdbc-postgresql quarkus-rest-jackson Looking for the newly published extensions in registry.quarkus.io [SUCCESS] ✅ Extension io.quarkus:quarkus-hibernate-orm-rest-data-panache has been installedExtension io.quarkus:quarkus-jdbc-postgresql was already installed
Extension io.quarkus:quarkus-rest-jackson was already installed
Use the extension command to add Hibernate ORM REST Data, the PostgreSQL JDBC driver, and REST Jackson support to the service. section 7.4
Extension io.quarkus:quarkus-jdbc-postgresql was already installed
