|
20 | 20 |
|
21 | 21 | import org.reactivestreams.Publisher;
|
22 | 22 |
|
| 23 | +import org.springframework.data.domain.Sort; |
23 | 24 | import org.springframework.data.r2dbc.convert.R2dbcConverter;
|
24 | 25 | import org.springframework.data.r2dbc.core.DatabaseClient;
|
25 | 26 | import org.springframework.data.r2dbc.core.R2dbcEntityOperations;
|
|
29 | 30 | import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
|
30 | 31 | import org.springframework.data.relational.core.query.Query;
|
31 | 32 | import org.springframework.data.relational.repository.query.RelationalEntityInformation;
|
32 |
| -import org.springframework.data.repository.reactive.ReactiveCrudRepository; |
| 33 | +import org.springframework.data.repository.reactive.ReactiveSortingRepository; |
33 | 34 | import org.springframework.data.util.Lazy;
|
34 | 35 | import org.springframework.transaction.annotation.Transactional;
|
35 | 36 | import org.springframework.util.Assert;
|
36 | 37 |
|
37 | 38 | /**
|
38 |
| - * Simple {@link ReactiveCrudRepository} implementation using R2DBC through {@link DatabaseClient}. |
| 39 | + * Simple {@link ReactiveSortingRepository} implementation using R2DBC through {@link DatabaseClient}. |
39 | 40 | *
|
40 | 41 | * @author Mark Paluch
|
41 | 42 | * @author Jens Schauder
|
42 | 43 | * @author Mingyuan Wu
|
| 44 | + * @author Stephen Cohen |
43 | 45 | */
|
44 | 46 | @Transactional(readOnly = true)
|
45 |
| -public class SimpleR2dbcRepository<T, ID> implements ReactiveCrudRepository<T, ID> { |
| 47 | +public class SimpleR2dbcRepository<T, ID> implements ReactiveSortingRepository<T, ID> { |
46 | 48 |
|
47 | 49 | private final RelationalEntityInformation<T, ID> entity;
|
48 | 50 | private final R2dbcEntityOperations entityOperations;
|
@@ -172,6 +174,14 @@ public Flux<T> findAll() {
|
172 | 174 | return this.entityOperations.select(Query.empty(), this.entity.getJavaType());
|
173 | 175 | }
|
174 | 176 |
|
| 177 | + /* (non-Javadoc) |
| 178 | + * @see org.springframework.data.repository.reactive.ReactiveSortingRepository#findAll(org.springframework.data.domain.Sort) |
| 179 | + */ |
| 180 | + @Override |
| 181 | + public Flux<T> findAll(Sort sort) { |
| 182 | + return this.entityOperations.select(Query.empty().sort(sort), this.entity.getJavaType()); |
| 183 | + } |
| 184 | + |
175 | 185 | /* (non-Javadoc)
|
176 | 186 | * @see org.springframework.data.repository.reactive.ReactiveCrudRepository#findAllById(java.lang.Iterable)
|
177 | 187 | */
|
|
0 commit comments