You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A change was introduced as part of #3602
Commit hash: 6ed274b
There seems to be a cache which was introduced while implementing above
if (hasIdentifier(bson)) {
S existing = findContextualEntity(context, entity, bson);
if (existing != null) {
return existing;
}
}
This however has an unintended effect for self referencing objects which don't use @DocumentReference, @Reference or @DbRef. Deserialization of these objects don't match the original saved object.
@Document
public class Form {
@Id
private String id;
private Form subForm;
}
@Test
public void testNestedForms() {
MongoTemplate mongoTemplate = getMongoTemplate();
Form form = new Form();
form.setId("dummyId");
form.setName("formName1");
Form subForm = new Form();
subForm.setId("dummyId");
subForm.setName("formName2");
form.setSubForm(subForm);
mongoTemplate.save(form);
//fails
Assert.assertEquals(form.getSubForm().getName(), formFromMongo.getSubForm().getName());
}
@Document
public static class Form {
@Id
private String id;
private String name;
private Form subForm;
}
Shouldn't this behaviour be limited to properties marked with reference annotations?
The text was updated successfully, but these errors were encountered:
mp911de
changed the title
3.x MongoMappingConvertor replacing non @DocumentReference, @Reference nested objects with same _idMappingMongoConverter replaces non-@DocumentReference nested objects with same _idAug 5, 2022
…stance of same type.
This commit ensures to fully resolve non association values from the given source document instead of trying attempt a by id lookup in already resolved instances.
Closes: #4098
Original pull request: #4133.
A change was introduced as part of #3602
Commit hash: 6ed274b
There seems to be a cache which was introduced while implementing above
This however has an unintended effect for self referencing objects which don't use
@DocumentReference
,@Reference
or@DbRef
. Deserialization of these objects don't match the original saved object.Sample Json:
After being inserted correctly the object on fetching returns an infinitely nested object:
Sample test code:
Shouldn't this behaviour be limited to properties marked with reference annotations?
The text was updated successfully, but these errors were encountered: