Skip to content

Commit 8f52a78

Browse files
committed
prepare switch
1 parent bd66031 commit 8f52a78

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.util.ArrayList;
1919
import java.util.List;
2020
import java.util.Optional;
21+
import java.util.function.Predicate;
2122

2223
import org.springframework.data.domain.Pageable;
2324
import org.springframework.data.domain.Sort;
@@ -261,6 +262,8 @@ private SelectBuilder.SelectJoin selectBuilder(Table table) {
261262
List<Expression> columnExpressions = new ArrayList<>();
262263
RelationalPersistentEntity<?> entity = entityMetadata.getTableEntity();
263264

265+
Predicate<AggregatePath> filter = ap -> returnedType.needsCustomConstruction() && !returnedType.getInputProperties().contains(ap.getRequiredBaseProperty().getName());
266+
264267
// sqlGeneratorSource.getSqlGenerator(entity.getType()).createSelectBuilder(
265268
//
266269
// , table)
@@ -274,11 +277,7 @@ private SelectBuilder.SelectJoin selectBuilder(Table table) {
274277
AggregatePath aggregatePath = context.getAggregatePath(path);
275278

276279
// TODO: special handling for custom construction?
277-
if (returnedType.needsCustomConstruction()) {
278-
if (!returnedType.getInputProperties().contains(aggregatePath.getRequiredBaseProperty().getName())) {
279-
continue;
280-
}
281-
}
280+
if (filter.test(aggregatePath)) { continue;}
282281

283282
// add a join if necessary
284283
Join join = getJoin(sqlContext, aggregatePath);

0 commit comments

Comments
 (0)