1

I would like to automatically persist the usual properties like createdAt/updatedAt and createdBy/updatedBy of my mongoDB base entity. With PostgreSQL I would use the @PrePersist and @PreUpdate annotations to achieve this.

How can I do this with MongoDB?

My BaseEntity:

public class BaseEntity extends ReactivePanacheMongoEntity {
    // [...]
    public ZonedDateTime createdAt;
    public ZonedDateTime updatedAt;
    public UUID createdBy;
    public UUID updatedBy;
}
Tim
  • 3,910
  • 8
  • 45
  • 80

0 Answers0