Preserve numeric keys that exceed Long range when mapping Updates.
This commit makes sure we preserve map keys no matter what. Closes #3552. Original pull request: #3565.
This commit is contained in:
committed by
Mark Paluch
parent
f93e40fdee
commit
c20feabada
@@ -1261,9 +1261,9 @@ public class QueryMapper {
|
||||
|
||||
String partial = iterator.next();
|
||||
|
||||
boolean isPositional = (isPositionalParameter(partial) && (property.isMap() || property.isCollectionLike()));
|
||||
boolean isPositional = isPositionalParameter(partial) && property.isCollectionLike();
|
||||
|
||||
if (isPositional) {
|
||||
if (isPositional || property.isMap()) {
|
||||
mappedName.append(".").append(partial);
|
||||
}
|
||||
|
||||
|
||||
@@ -1089,6 +1089,27 @@ class UpdateMapperUnitTests {
|
||||
assertThat(mappedUpdate).isEqualTo(new Document("$set", new Document("aliased.$[element].value", 10)));
|
||||
}
|
||||
|
||||
@Test // GH-3552
|
||||
void numericKeyForMap() {
|
||||
|
||||
Update update = new Update().set("map.601218778970110001827396", "testing");
|
||||
Document mappedUpdate = mapper.getMappedObject(update.getUpdateObject(),
|
||||
context.getPersistentEntity(EntityWithObjectMap.class));
|
||||
|
||||
assertThat(mappedUpdate).isEqualTo(Document.parse("{\"$set\": {\"map.601218778970110001827396\": \"testing\"}}"));
|
||||
}
|
||||
|
||||
@Test // GH-3552
|
||||
void numericKeyInMapOfNestedPath() {
|
||||
|
||||
Update update = new Update().set("map.601218778970110001827396.value", "testing");
|
||||
Document mappedUpdate = mapper.getMappedObject(update.getUpdateObject(),
|
||||
context.getPersistentEntity(EntityWithObjectMap.class));
|
||||
|
||||
assertThat(mappedUpdate)
|
||||
.isEqualTo(Document.parse("{\"$set\": {\"map.601218778970110001827396.value\": \"testing\"}}"));
|
||||
}
|
||||
|
||||
static class DomainTypeWrappingConcreteyTypeHavingListOfInterfaceTypeAttributes {
|
||||
ListModelWrapper concreteTypeWithListAttributeOfInterfaceType;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user