Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

entity listener with multiple @PrePersist (for example) methods #687

Open
gavinking opened this issue Nov 23, 2024 · 1 comment · May be fixed by #688
Open

entity listener with multiple @PrePersist (for example) methods #687

gavinking opened this issue Nov 23, 2024 · 1 comment · May be fixed by #688

Comments

@gavinking
Copy link
Contributor

I can't find where we specify whether this is allowed:

class EntityListener {
   @PrePersist void onPersistBook(Book book) {}
   @PrePersist void onPersistAuthor(Author book) {}
}

I think it should be allowed.

@gavinking
Copy link
Contributor Author

Oh, wait, I did find it, buried in the section on XML:

An entity listener class can define multiple
callback methods. However, at most one method of an entity listener
class can be designated as a pre-persist method, post-persist method,
pre-remove method, post-remove method, pre-update method, post-update
method, and/or post-load method, regardless of whether the XML
descriptor is used to define entity listeners or whether some
combination of annotations and XML descriptor elements is used.

But I think we should change this.

gavinking added a commit to gavinking/persistence that referenced this issue Nov 23, 2024
also write proper javadoc, and clean up the spec

see jakartaee#687

see jakartaee#684

Signed-off-by: Gavin King <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant