@@ -145,7 +145,10 @@ public Page<T> findAll(Pageable pageable) {
145145
146146 Assert .notNull (pageable , "Pageable must not be null" );
147147
148- Query query = applyPageable (Query .query (CriteriaDefinition .empty ()), pageable );
148+ Query query1 = Query .query (CriteriaDefinition .empty ());
149+
150+
151+ Query query = query1 .with (pageable );
149152 List <T > content = entityOperations .findAll (query , entity .getType ());
150153
151154 return PageableExecutionUtils .getPage (content , pageable , () -> entityOperations .count (entity .getType ()));
@@ -184,7 +187,9 @@ public <S extends T> Page<S> findAll(Example<S> example, Pageable pageable) {
184187 Assert .notNull (pageable , "Pageable must not be null" );
185188
186189 Query mappedQuery = this .exampleMapper .getMappedExample (example );
187- Query contentQuery = applyPageable (mappedQuery , pageable );
190+
191+
192+ Query contentQuery = mappedQuery .with (pageable );
188193
189194 List <S > content = this .entityOperations .findAll (contentQuery , example .getProbeType ());
190195
@@ -219,12 +224,4 @@ public <S extends T, R> R findBy(Example<S> example, Function<FluentQuery.Fetcha
219224 return queryFunction .apply (fluentQuery );
220225 }
221226
222- private Query applyPageable (Query query , Pageable pageable ) {
223-
224- if (pageable .isPaged ()) {
225- query = query .limit (pageable .getPageSize ()).offset (pageable .getOffset ());
226- }
227-
228- return query .sort (pageable .getSort ());
229- }
230227}
0 commit comments