31
31
import org .springframework .data .domain .PageImpl ;
32
32
import org .springframework .data .domain .Pageable ;
33
33
import org .springframework .data .domain .Sort ;
34
+ import org .springframework .data .keyvalue .core .IterableConverter ;
34
35
import org .springframework .data .keyvalue .core .KeyValueOperations ;
35
36
import org .springframework .data .mapping .PersistentEntity ;
36
37
import org .springframework .data .mapping .PersistentProperty ;
39
40
import org .springframework .data .projection .ProjectionFactory ;
40
41
import org .springframework .data .projection .SpelAwareProxyProjectionFactory ;
41
42
import org .springframework .data .querydsl .EntityPathResolver ;
43
+ import org .springframework .data .querydsl .ListQuerydslPredicateExecutor ;
42
44
import org .springframework .data .querydsl .QuerydslPredicateExecutor ;
43
45
import org .springframework .data .querydsl .SimpleEntityPathResolver ;
44
46
import org .springframework .data .repository .core .EntityInformation ;
61
63
* @author Mark Paluch
62
64
* @since 2.6
63
65
*/
64
- public class QuerydslKeyValuePredicateExecutor <T > implements QuerydslPredicateExecutor <T > {
66
+ public class QuerydslKeyValuePredicateExecutor <T > implements ListQuerydslPredicateExecutor <T > {
65
67
66
68
private static final EntityPathResolver DEFAULT_ENTITY_PATH_RESOLVER = SimpleEntityPathResolver .INSTANCE ;
67
69
68
70
private final MappingContext <? extends PersistentEntity <?, ?>, ? extends PersistentProperty <?>> context ;
69
71
private final PathBuilder <T > builder ;
70
- private final Supplier <Iterable <T >> findAll ;
72
+ private final Supplier <List <T >> findAll ;
71
73
private final EntityInformation <T , ?> entityInformation ;
72
74
private final ProjectionFactory projectionFactory ;
73
75
private final EntityInstantiators entityInstantiators = new EntityInstantiators ();
@@ -105,7 +107,7 @@ public QuerydslKeyValuePredicateExecutor(EntityInformation<T, ?> entityInformati
105
107
EntityPath <T > path = resolver .createPath (entityInformation .getJavaType ());
106
108
this .builder = new PathBuilder <>(path .getType (), path .getMetadata ());
107
109
this .entityInformation = entityInformation ;
108
- findAll = () -> operations .findAll (entityInformation .getJavaType ());
110
+ findAll = () -> IterableConverter . toList ( operations .findAll (entityInformation .getJavaType () ));
109
111
}
110
112
111
113
@ Override
@@ -121,15 +123,15 @@ public Optional<T> findOne(Predicate predicate) {
121
123
}
122
124
123
125
@ Override
124
- public Iterable <T > findAll (Predicate predicate ) {
126
+ public List <T > findAll (Predicate predicate ) {
125
127
126
128
Assert .notNull (predicate , "Predicate must not be null!" );
127
129
128
130
return prepareQuery (predicate ).fetchResults ().getResults ();
129
131
}
130
132
131
133
@ Override
132
- public Iterable <T > findAll (Predicate predicate , OrderSpecifier <?>... orders ) {
134
+ public List <T > findAll (Predicate predicate , OrderSpecifier <?>... orders ) {
133
135
134
136
Assert .notNull (predicate , "Predicate must not be null!" );
135
137
Assert .notNull (orders , "OrderSpecifiers must not be null!" );
@@ -141,7 +143,7 @@ public Iterable<T> findAll(Predicate predicate, OrderSpecifier<?>... orders) {
141
143
}
142
144
143
145
@ Override
144
- public Iterable <T > findAll (Predicate predicate , Sort sort ) {
146
+ public List <T > findAll (Predicate predicate , Sort sort ) {
145
147
146
148
Assert .notNull (predicate , "Predicate must not be null!" );
147
149
Assert .notNull (sort , "Sort must not be null!" );
@@ -171,7 +173,7 @@ public Page<T> findAll(Predicate predicate, Pageable pageable) {
171
173
}
172
174
173
175
@ Override
174
- public Iterable <T > findAll (OrderSpecifier <?>... orders ) {
176
+ public List <T > findAll (OrderSpecifier <?>... orders ) {
175
177
176
178
Assert .notNull (orders , "OrderSpecifiers must not be null!" );
177
179
0 commit comments