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

ReactiveAfterConvertCallback not called after find operations #1854

Open
micopiira opened this issue Oct 19, 2023 · 3 comments · May be fixed by #1891
Open

ReactiveAfterConvertCallback not called after find operations #1854

micopiira opened this issue Oct 19, 2023 · 3 comments · May be fixed by #1891
Labels
type: task A general task

Comments

@micopiira
Copy link
Contributor

To me it seems that ReactiveAfterConvertCallback is only called after entity save operations so I guess that at the moment we cannot modify entities after find operations using entity callbacks?

The method javadoc does state that Entity callback method invoked after a domain object is converted to be persisted. although the class level javadoc says Callback being invoked after a domain object is materialized from a CouchbaseDocument when reading results. these seem contradicting to me?

Maybe we need to implement more callbacks, possibly borrowing following callbacks from spring-data-mongodb?

The following callback methods are present in AbstractMappingEventListener:
onBeforeConvert: Called in MongoTemplate insert, insertList, and save operations before the object is converted to a Document by a MongoConverter.
onBeforeSave: Called in MongoTemplate insert, insertList, and save operations before inserting or saving the Document in the database.
onAfterSave: Called in MongoTemplate insert, insertList, and save operations after inserting or saving the Document in the database.
onAfterLoad: Called in MongoTemplate find, findAndRemove, findOne, and getCollection methods after the Document has been retrieved from the database.
onAfterConvert: Called in MongoTemplate find, findAndRemove, findOne, and getCollection methods after the Document has been retrieved from the database was converted to a POJO.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 19, 2023
@micopiira
Copy link
Contributor Author

@mikereiche ok, thanks for verifying my assumption.

To be able to use spring-data-couchbase I would need an easy way to modify entities after fetching them from the database, as currently there is no easy way to do this are you interested in implementing new callbacks for modifying entities after find operations and also possibly try to unify the callbacks with spring-data-mongodb?

I could also try to come up with a a PR for this if this is something of interest to you.

@mikereiche
Copy link
Collaborator

If you make a PR, I'll approve it. Just follow the pattern of the other callbacks.
Otherwise, you'll have to wait for me to do it :(

@micopiira micopiira linked a pull request Jan 3, 2024 that will close this issue
5 tasks
@mikereiche mikereiche added type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task A general task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants