Skip to content

Commit 36fd1ba

Browse files
committed
removed duplication
1 parent 8f52a78 commit 36fd1ba

File tree

1 file changed

+45
-46
lines changed

1 file changed

+45
-46
lines changed

spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/query/JdbcQueryCreator.java

Lines changed: 45 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -264,53 +264,52 @@ private SelectBuilder.SelectJoin selectBuilder(Table table) {
264264

265265
Predicate<AggregatePath> filter = ap -> returnedType.needsCustomConstruction() && !returnedType.getInputProperties().contains(ap.getRequiredBaseProperty().getName());
266266

267-
// sqlGeneratorSource.getSqlGenerator(entity.getType()).createSelectBuilder(
267+
return (SelectBuilder.SelectJoin) sqlGeneratorSource.getSqlGenerator(entity.getType()).createSelectBuilder(
268+
filter
269+
, table);
268270
//
269-
// , table)
270-
271-
SqlContext sqlContext = new SqlContext();
272-
273-
List<Join> joinTables = new ArrayList<>();
274-
for (PersistentPropertyPath<RelationalPersistentProperty> path : context
275-
.findPersistentPropertyPaths(entity.getType(), p -> true)) {
276-
277-
AggregatePath aggregatePath = context.getAggregatePath(path);
278-
279-
// TODO: special handling for custom construction?
280-
if (filter.test(aggregatePath)) { continue;}
281-
282-
// add a join if necessary
283-
Join join = getJoin(sqlContext, aggregatePath);
284-
if (join != null) {
285-
joinTables.add(join);
286-
}
287-
288-
Column column = getColumn(sqlContext, aggregatePath);
289-
if (column != null) {
290-
columnExpressions.add(column);
291-
}
292-
}
293-
294-
SelectBuilder.SelectJoin baseSelect = StatementBuilder.select(columnExpressions).from(table);
295-
296-
// TODO: included in SqlGenerator.Join
297-
for (Join join : joinTables) {
298-
299-
Condition condition = null;
300-
301-
for (int i = 0; i < join.joinColumns.size(); i++) {
302-
Column parentColumn = join.parentId.get(i);
303-
Column joinColumn = join.joinColumns.get(i);
304-
Comparison singleCondition = joinColumn.isEqualTo(parentColumn);
305-
condition = condition == null ? singleCondition : condition.and(singleCondition);
306-
}
307-
308-
Assert.state(condition != null, "No condition found");
309-
310-
baseSelect = baseSelect.leftOuterJoin(join.joinTable).on(condition);
311-
}
312-
313-
return baseSelect;
271+
// SqlContext sqlContext = new SqlContext();
272+
//
273+
// List<Join> joinTables = new ArrayList<>();
274+
// for (PersistentPropertyPath<RelationalPersistentProperty> path : context
275+
// .findPersistentPropertyPaths(entity.getType(), p -> true)) {
276+
//
277+
// AggregatePath aggregatePath = context.getAggregatePath(path);
278+
//
279+
// if (filter.test(aggregatePath)) { continue;}
280+
//
281+
// // add a join if necessary
282+
// Join join = getJoin(sqlContext, aggregatePath);
283+
// if (join != null) {
284+
// joinTables.add(join);
285+
// }
286+
//
287+
// Column column = getColumn(sqlContext, aggregatePath);
288+
// if (column != null) {
289+
// columnExpressions.add(column);
290+
// }
291+
// }
292+
//
293+
// SelectBuilder.SelectJoin baseSelect = StatementBuilder.select(columnExpressions).from(table);
294+
//
295+
// // TODO: included in SqlGenerator.Join
296+
// for (Join join : joinTables) {
297+
//
298+
// Condition condition = null;
299+
//
300+
// for (int i = 0; i < join.joinColumns.size(); i++) {
301+
// Column parentColumn = join.parentId.get(i);
302+
// Column joinColumn = join.joinColumns.get(i);
303+
// Comparison singleCondition = joinColumn.isEqualTo(parentColumn);
304+
// condition = condition == null ? singleCondition : condition.and(singleCondition);
305+
// }
306+
//
307+
// Assert.state(condition != null, "No condition found");
308+
//
309+
// baseSelect = baseSelect.leftOuterJoin(join.joinTable).on(condition);
310+
// }
311+
//
312+
// return baseSelect;
314313
}
315314

316315
/**

0 commit comments

Comments
 (0)