diff --git a/src/main/java/org/springframework/data/jdbc/core/EntityRowMapper.java b/src/main/java/org/springframework/data/jdbc/core/EntityRowMapper.java index 9ff594c4..dbaa053e 100644 --- a/src/main/java/org/springframework/data/jdbc/core/EntityRowMapper.java +++ b/src/main/java/org/springframework/data/jdbc/core/EntityRowMapper.java @@ -70,11 +70,9 @@ public class EntityRowMapper implements RowMapper { T result = createInstance(entity, resultSet, ""); - if (entity.requiresPropertyPopulation()) { - return populateProperties(result, resultSet); - } - - return result; + return entity.requiresPropertyPopulation() // + ? populateProperties(result, resultSet) // + : result; } private T populateProperties(T result, ResultSet resultSet) { @@ -92,12 +90,16 @@ public class EntityRowMapper implements RowMapper { } if (property.isCollectionLike() && id != null) { + propertyAccessor.setProperty(property, accessStrategy.findAllByProperty(id, property)); + } else if (property.isMap() && id != null) { Iterable allByProperty = accessStrategy.findAllByProperty(id, property); propertyAccessor.setProperty(property, ITERABLE_OF_ENTRY_TO_MAP_CONVERTER.convert(allByProperty)); + } else { + propertyAccessor.setProperty(property, readFrom(resultSet, property, "")); } }