52
52
import org .springframework .data .relational .core .mapping .event .*;
53
53
import org .springframework .data .relational .core .query .Query ;
54
54
import org .springframework .data .support .PageableExecutionUtils ;
55
+ import org .springframework .data .util .Streamable ;
55
56
import org .springframework .lang .Nullable ;
56
57
import org .springframework .util .Assert ;
57
58
import org .springframework .util .ClassUtils ;
@@ -171,7 +172,7 @@ public <T> T save(T instance) {
171
172
}
172
173
173
174
@ Override
174
- public <T > Iterable <T > saveAll (Iterable <T > instances ) {
175
+ public <T > List <T > saveAll (Iterable <T > instances ) {
175
176
176
177
Assert .notNull (instances , "Aggregate instances must not be null" );
177
178
@@ -204,7 +205,7 @@ public <T> T insert(T instance) {
204
205
}
205
206
206
207
@ Override
207
- public <T > Iterable <T > insertAll (Iterable <T > instances ) {
208
+ public <T > List <T > insertAll (Iterable <T > instances ) {
208
209
209
210
Assert .notNull (instances , "Aggregate instances must not be null" );
210
211
@@ -239,7 +240,7 @@ public <T> T update(T instance) {
239
240
}
240
241
241
242
@ Override
242
- public <T > Iterable <T > updateAll (Iterable <T > instances ) {
243
+ public <T > List <T > updateAll (Iterable <T > instances ) {
243
244
244
245
Assert .notNull (instances , "Aggregate instances must not be null" );
245
246
@@ -298,7 +299,7 @@ public <T> T findById(Object id, Class<T> domainType) {
298
299
}
299
300
300
301
@ Override
301
- public <T > Iterable <T > findAll (Class <T > domainType , Sort sort ) {
302
+ public <T > List <T > findAll (Class <T > domainType , Sort sort ) {
302
303
303
304
Assert .notNull (domainType , "Domain type must not be null" );
304
305
@@ -323,8 +324,13 @@ public <T> Optional<T> findOne(Query query, Class<T> domainType) {
323
324
}
324
325
325
326
@ Override
326
- public <T > Iterable <T > findAll (Query query , Class <T > domainType ) {
327
- return accessStrategy .findAll (query , domainType );
327
+ public <T > List <T > findAll (Query query , Class <T > domainType ) {
328
+
329
+ Iterable <T > all = accessStrategy .findAll (query , domainType );
330
+ if (all instanceof List <T > list ) {
331
+ return list ;
332
+ }
333
+ return Streamable .of (all ).toList ();
328
334
}
329
335
330
336
@ Override
@@ -337,7 +343,7 @@ public <T> Page<T> findAll(Query query, Class<T> domainType, Pageable pageable)
337
343
}
338
344
339
345
@ Override
340
- public <T > Iterable <T > findAll (Class <T > domainType ) {
346
+ public <T > List <T > findAll (Class <T > domainType ) {
341
347
342
348
Assert .notNull (domainType , "Domain type must not be null" );
343
349
@@ -346,7 +352,7 @@ public <T> Iterable<T> findAll(Class<T> domainType) {
346
352
}
347
353
348
354
@ Override
349
- public <T > Iterable <T > findAllById (Iterable <?> ids , Class <T > domainType ) {
355
+ public <T > List <T > findAllById (Iterable <?> ids , Class <T > domainType ) {
350
356
351
357
Assert .notNull (ids , "Ids must not be null" );
352
358
Assert .notNull (domainType , "Domain type must not be null" );
@@ -607,7 +613,7 @@ private MutableAggregateChange<?> createDeletingChange(Class<?> domainType) {
607
613
return aggregateChange ;
608
614
}
609
615
610
- private <T > Iterable <T > triggerAfterConvert (Iterable <T > all ) {
616
+ private <T > List <T > triggerAfterConvert (Iterable <T > all ) {
611
617
612
618
List <T > result = new ArrayList <>();
613
619
0 commit comments