Repository navigation
6.0.0
MonkeyJpaRepository
Using MonkeyJpaRepository, the findAll method with a Specification (using groupBy) and Pageable will return a Page<T> where getTotalElements() correctly reflects the number of grouped items.
To use this feature, follow the steps below:
1. Apply MonkeyJpaRepository in Repository
When creating the repository, extend from MonkeyJpaRepository instead of JpaRepository to ensure counting is performed correctly.
interface PayableRepository extends MonkeyJpaRepository<Payable, PayableId>, JpaSpecificationExecutor<Payable> {}2. Add a @Import in MysqlIntegrationContainerConfiguration
This is necessary to ensure that, when running tests, the custom implementation is properly loaded.
@Import({ MonkeyJpaRepositoriesAutoConfiguration.class })