@@ -54,8 +54,8 @@ public class PartTreeJdbcQuery extends AbstractJdbcQuery {
54
54
private final Dialect dialect ;
55
55
private final JdbcConverter converter ;
56
56
private final PartTree tree ;
57
- private final JdbcQueryExecution <?> execution ;
58
- private final RowMapper < Object > rowMapper ;
57
+ /** The execution for obtaining the bulk of the data. The execution may be decorated with further processing for handling sliced or paged queries */
58
+ private final JdbcQueryExecution <?> coreExecution ;
59
59
60
60
/**
61
61
* Creates a new {@link PartTreeJdbcQuery}.
@@ -87,9 +87,8 @@ public PartTreeJdbcQuery(RelationalMappingContext context, JdbcQueryMethod query
87
87
88
88
ResultSetExtractor <Boolean > extractor = tree .isExistsProjection () ? (ResultSet ::next ) : null ;
89
89
90
- this .execution = queryMethod .isPageQuery () || queryMethod .isSliceQuery () ? collectionQuery (rowMapper )
90
+ this .coreExecution = queryMethod .isPageQuery () || queryMethod .isSliceQuery () ? collectionQuery (rowMapper )
91
91
: getQueryExecution (queryMethod , extractor , rowMapper );
92
- this .rowMapper = rowMapper ;
93
92
}
94
93
95
94
private Sort getDynamicSort (RelationalParameterAccessor accessor ) {
@@ -106,20 +105,23 @@ public Object execute(Object[] values) {
106
105
RelationalParametersParameterAccessor accessor = new RelationalParametersParameterAccessor (getQueryMethod (),
107
106
values );
108
107
ParametrizedQuery query = createQuery (accessor );
109
- JdbcQueryExecution <?> execution = getQueryExecution (accessor );
108
+ JdbcQueryExecution <?> execution = getDecoratedExecution (accessor );
110
109
111
110
return execution .execute (query .getQuery (), query .getParameterSource ());
112
111
}
113
112
114
- private JdbcQueryExecution <?> getQueryExecution (RelationalParametersParameterAccessor accessor ) {
113
+ /**
114
+ * The decorated execution is the {@link #coreExecution} decorated with further processing for handling sliced or paged queries.
115
+ */
116
+ private JdbcQueryExecution <?> getDecoratedExecution (RelationalParametersParameterAccessor accessor ) {
115
117
116
118
if (getQueryMethod ().isSliceQuery ()) {
117
- return new SliceQueryExecution <>((JdbcQueryExecution <Collection <Object >>) this .execution , accessor .getPageable ());
119
+ return new SliceQueryExecution <>((JdbcQueryExecution <Collection <Object >>) this .coreExecution , accessor .getPageable ());
118
120
}
119
121
120
122
if (getQueryMethod ().isPageQuery ()) {
121
123
122
- return new PageQueryExecution <>((JdbcQueryExecution <Collection <Object >>) this .execution , accessor .getPageable (),
124
+ return new PageQueryExecution <>((JdbcQueryExecution <Collection <Object >>) this .coreExecution , accessor .getPageable (),
123
125
() -> {
124
126
125
127
RelationalEntityMetadata <?> entityMetadata = getQueryMethod ().getEntityInformation ();
@@ -135,7 +137,7 @@ private JdbcQueryExecution<?> getQueryExecution(RelationalParametersParameterAcc
135
137
});
136
138
}
137
139
138
- return this .execution ;
140
+ return this .coreExecution ;
139
141
}
140
142
141
143
protected ParametrizedQuery createQuery (RelationalParametersParameterAccessor accessor ) {
@@ -192,8 +194,8 @@ static class PageQueryExecution<T> implements JdbcQueryExecution<Slice<T>> {
192
194
private final Pageable pageable ;
193
195
private final LongSupplier countSupplier ;
194
196
195
- public PageQueryExecution (JdbcQueryExecution <? extends Collection <T >> delegate , Pageable pageable ,
196
- LongSupplier countSupplier ) {
197
+ PageQueryExecution (JdbcQueryExecution <? extends Collection <T >> delegate , Pageable pageable ,
198
+ LongSupplier countSupplier ) {
197
199
this .delegate = delegate ;
198
200
this .pageable = pageable ;
199
201
this .countSupplier = countSupplier ;
0 commit comments