412-frameworks-quarkus-panache
Installation
SKILL.md
Hibernate ORM with Panache
Apply Panache patterns for Hibernate ORM in Quarkus.
What is covered in this Skill?
- Active record (PanacheEntity) vs PanacheRepository — when to use each
- Parameterized JPQL / Panache queries: positional (?1) and named (:param) — no unsafe concatenation
- @NamedQuery on entities for reusable, build-time validated queries
- DTO projections with project(Class) to avoid exposing managed entities
- Pagination with Page.of(pageIndex, pageSize) and query.count()
- N+1 avoidance with JOIN FETCH in JPQL queries
- Optimistic locking with @Version and handling OptimisticLockException
- @Transactional application services
- @TestTransaction for automatic rollback in @QuarkusTest tests
- Mapping entities vs exposing DTOs at REST boundaries
- Native queries via Hibernate when you want controlled SQL in the same transaction; pairing with
@411for JDBC when bypassing Hibernate at the boundary
Scope: Apply recommendations based on the reference rules and good/bad code examples.