Skip to content
Discussion options

You must be logged in to vote

I'm not sure it should: Hibernate Data Repositories (the implementation of Jakarta Data 1.0) is backed by StatelessSessions, which expose the insert() method to "save" entities and not persist(), which does not trigger @PrePersist entity lifecycle callbacks (see https://docs.hibernate.org/orm/7.4/repositories/html_single/#programming-model). A @PostPersist method would work, but that of course has different semantics (runs after the insert is executed on the database).

Jakarta Persistence 4.0 introduces a @PreInsert lifecycle event, providing a stateless alternative, but that will be supported by Hibernate 8.0 which is currently not available in Quarkus.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@FroMage
Comment options

FroMage Jun 25, 2026
Collaborator

@mbellade
Comment options

Answer selected by FroMage
@FroMage
Comment options

FroMage Jun 25, 2026
Collaborator

@lordofthejars
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
area/data Quarkus Data. For lower-level issues, consider area/jdbc, area/hibernate-orm, area/agroal instead.
3 participants