Nested JSON Handling Issue in Generic Class #4669
Labels
status: feedback-provided
Feedback has been provided
status: waiting-for-triage
An issue we've not yet triaged
I encountered an issue while working with Spring Data MongoDB latest version, where nested JSON objects within a generic class are not being handled correctly. Specifically, when attempting to interact with nested JSON structures using Spring Data MongoDB repositories, the behavior does not align with expectations.
Here a repository to reproduce.
Potential bug discovered
When attempting to load a complex structure involving generic classes and nested JSON within a Spring Data MongoDB document, the document fails to load correctly. Despite following standard procedures for data retrieval, the loaded document exhibits inconsistencies, particularly regarding the handling of nested JSON structures.
It's observed that the order of attributes in the entity class has a peculiar effect on the loading process. Specifically, the first generic item within the entity seems to be handled correctly, while the subsequent ones are not processed as expected. This behavior is unexpected and indicates a potential issue with the loading mechanism.
Upon inspection, it becomes evident that the first generic class is loaded correctly, whereas the second one fails to be properly processed during the document loading procedure. This inconsistency in handling generic classes within the document poses a significant hurdle, leading to data integrity concerns and unpredictable behavior.
Set to reproduce demo repository
Expected Behavior:
The saved MyEntity instances should be retrieved from the database without any errors or data loss. Both attribute1 and attribute2 should contain their respective nested JSON structures (Structure1 and Structure2).
Actual Behavior:
Upon loading the MyEntity instances, potential issues may arise where the nested JSON structures within attribute1 and attribute2 are not correctly parsed or mapped, leading to unexpected behavior or data inconsistency.
The text was updated successfully, but these errors were encountered: