Open Peak-Song opened 4 hours ago
Hi, thank you for your kind words. I'd suggest using the fragment (custom repository approach) - https://docs.spring.io/spring-data/jpa/reference/repositories/custom-implementations.html
public interface ReactivePagingRepository<T> {
Mono<T> simplePaging(String string);
}
import org.springframework.context.annotation.Lazy;
import reactor.core.publisher.Mono;
public class ReactivePagingRepositoryImpl<T> implements ReactivePagingRepository<T> {
private final QuerydslR2dbcFragment querydslR2dbcFragment;
public ReactivePagingRepositoryImpl(@Lazy QuerydslR2dbcFragment querydslR2dbcFragment) {
this.querydslR2dbcFragment = querydslR2dbcFragment;
}
@Override
public Mono<T> simplePaging(... parameters) {
... implementation
}
}
This is implementation side, on use side you need to do something like
public interface PersonRepository extends QuerydslR2dbcRepository<Person, Long>, ReactivePagingRepository<Person> {
}
You can of course introduce another abstract interface that extends QuerydslR2dbcRepository<T, ID>, ReactivePagingRepository<T>
like QuerydslR2dbcRepository
does so your concrete repositories doesn't have to extend both but this approach is arbitrary. To keep the repository implementation clean I'd suggest keeping the repository hierarchies as separate as possible.
Thanks for your amazing project, I feels exceptionally smooth when using r2dbc and querydsl, so I strongly recommend it to my colleagues. However, I have a small question I'd like to ask you.
I want to extend the origin Repository to implement my own Repository, such as ReactivePagingRepository below.
And Then implement the interface with
Finally, I use it like this
But it raise exception whrn project start.
Caused by: org.springframework.data.mapping.PropertyReferenceException: No property 'simplePaging' found for type 'ApiTree'
there is the project dependency I use -- springboot3.3.3 and
Is there Anyway to achieve this feature? Please tell me, thanks a lot~