diff --git a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/DomainObjectReader.java b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/DomainObjectReader.java index 82c03deab..94b75e14a 100644 --- a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/DomainObjectReader.java +++ b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/DomainObjectReader.java @@ -685,9 +685,8 @@ public class DomainObjectReader { result = mergeCollections(property, sourceValue, targetValue, mapper); } else if (property.isEntity()) { - result = targetValue.isEmpty() - ? sourceValue - : targetValue.flatMap(t -> sourceValue.map(s -> mergeForPut(s, t, mapper))); + result = targetValue.isPresent() ? targetValue.flatMap(t -> sourceValue.map(s -> mergeForPut(s, t, mapper))) + : sourceValue; } else { result = sourceValue; }