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

Allow DbRefResolver to resolve bulk entities #4820

Open
mikeyg123 opened this issue Oct 24, 2024 · 0 comments
Open

Allow DbRefResolver to resolve bulk entities #4820

mikeyg123 opened this issue Oct 24, 2024 · 0 comments
Assignees
Labels
status: waiting-for-triage An issue we've not yet triaged

Comments

@mikeyg123
Copy link

mikeyg123 commented Oct 24, 2024

It is relatively easy to override DbRefResolver.resolveDbRef() to return a single cached entity object
But if you want to handle the case where the property is a collection of DbRefs it is impossible. The method has no access to the list of DbRef values.
While you can override the bulkFetch() method this returns a list of Document objects - not useful if your cache contains the deserialized objects.
Currently the only solution is to extensively override the MappingMongoConverter. Since many of the methods in this class are private or package scope this requires a lot of code which will likely break with future updates.

Please add a new bulkResolveDbRef() method to DbRefResolver and call this from either MongoMappingConverter.bulkReadAndConvertDBRefs() (before bulkReadRefs()) or MappingMongoConverter.readAssociation() and passing in the full list of DbRefs to give the DbRefResolver a chance to retrieve cached entities.
Ideally DbRefResolver could return a partial list or map DbRef -> Object and MongoMappingConverter could fetch the remaining.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 24, 2024
@mp911de mp911de changed the title Allow DbRefResolver to handle bulk resolveDbRef to entity value objects Allow DbRefResolver to resolve bulk entities Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

3 participants