Skip to content

quarkus-mongodb-panache support for prePersist/posPersist operations #9272

@diogocarleto

Description

@diogocarleto

Hi guys, hope you are doing well.

In JPA it is possible to use annotations such as @PrePersist, @PostPersist to execute oparations before and after the persist/merge.

What if we implement this on mongodb panache, I took a look and it seems pretty simple to implement.

We can use the MongoOperations.persist, and MongoOperations.update to apply a kind of interceptor scanning the entity for a method using these annotations, and execute those methods.

Bellow a snippet of code:

@PrePersist
public void prePersist() {
    System.out.println("prePersis");
}

@PostPersist
public void postPersist() {
    System.out.println("postPersist");
}

I didn't send this yet for the [email protected], let me know if this idea is a good, and if I have to send to googlegroups.

Best,

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions