Skip to content

Commit 84379b2

Browse files
committed
DATAJDBC-252 - Polishing.
Original pull request: #86.
1 parent 2a55aeb commit 84379b2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/main/java/org/springframework/data/jdbc/core/EntityRowMapper.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,9 @@ public T mapRow(ResultSet resultSet, int rowNumber) {
7070

7171
T result = createInstance(entity, resultSet, "");
7272

73-
if (entity.requiresPropertyPopulation()) {
74-
return populateProperties(result, resultSet);
75-
}
76-
77-
return result;
73+
return entity.requiresPropertyPopulation() //
74+
? populateProperties(result, resultSet) //
75+
: result;
7876
}
7977

8078
private T populateProperties(T result, ResultSet resultSet) {
@@ -92,12 +90,16 @@ private T populateProperties(T result, ResultSet resultSet) {
9290
}
9391

9492
if (property.isCollectionLike() && id != null) {
93+
9594
propertyAccessor.setProperty(property, accessStrategy.findAllByProperty(id, property));
95+
9696
} else if (property.isMap() && id != null) {
9797

9898
Iterable<Object> allByProperty = accessStrategy.findAllByProperty(id, property);
9999
propertyAccessor.setProperty(property, ITERABLE_OF_ENTRY_TO_MAP_CONVERTER.convert(allByProperty));
100+
100101
} else {
102+
101103
propertyAccessor.setProperty(property, readFrom(resultSet, property, ""));
102104
}
103105
}

0 commit comments

Comments
 (0)