Skip to content

6.0.0

Choose a tag to compare

@Braullio Braullio released this 02 Jun 18:16
6a9b69e

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 })