Skip to content

Commit a5107cd

Browse files
committed
Polishing.
Simplify code, remove code that is commented out, extract methods, pass PersistentEntity as argument instead of creating instances that hold PersistentEntity as field to align the class lifecycle with its contextual usage.
1 parent 910ad96 commit a5107cd

File tree

5 files changed

+151
-192
lines changed

5 files changed

+151
-192
lines changed

Diff for: spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/AggregateReader.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class AggregateReader<T> implements PathToColumnMapping {
7070
this.aggregate = aggregate;
7171
this.jdbcTemplate = jdbcTemplate;
7272
this.table = Table.create(aggregate.getQualifiedTableName());
73-
this.sqlGenerator = new SingleQuerySqlGenerator(converter.getMappingContext(), aliasFactory, dialect, aggregate);
73+
this.sqlGenerator = new SingleQuerySqlGenerator(converter.getMappingContext(), aliasFactory, dialect);
7474
this.aliasFactory = aliasFactory;
7575
this.extractor = new RowDocumentResultSetExtractor(converter.getMappingContext(), this);
7676
}
@@ -115,7 +115,7 @@ public List<T> findAllById(Iterable<?> ids) {
115115

116116
@SuppressWarnings("ConstantConditions")
117117
public List<T> findAll() {
118-
return jdbcTemplate.query(sqlGenerator.findAll(), this::extractAll);
118+
return jdbcTemplate.query(sqlGenerator.findAll(aggregate), this::extractAll);
119119
}
120120

121121
public List<T> findAll(Query query) {
@@ -127,7 +127,7 @@ private <R> R doFind(Query query, ResultSetExtractor<R> extractor) {
127127

128128
MapSqlParameterSource parameterSource = new MapSqlParameterSource();
129129
Condition condition = createCondition(query, parameterSource);
130-
String sql = sqlGenerator.findAll(condition);
130+
String sql = sqlGenerator.findAll(aggregate, condition);
131131

132132
return jdbcTemplate.query(sql, parameterSource, extractor);
133133
}

0 commit comments

Comments
 (0)