Problem encountered using VaadinSpringDataHelper

I have encountered a problem with VaadinSpringDataHelper.
I have a class say ExampleView in which I display ExampleDTO objects which I get from ExampleService in which I use ExampleRepository. ExampleRepository extends Example as a database entity, and in the service I map them to ExampleDTO. This results in the fact that when I try to use VaadinSpringDataHelper.fromPagingRepository, I can’t use my repository, because the objects don’t match between the grid that accepts ExampleDTO and the repo that returns Example database entity. Below is a minimal code example:

Is there any way I can use VaadinSpringDataHelper with DTO?

// ExampleRepository.java

@Repository
public interface ExampleRepository extends JpaRepository<Example, Long>{}

//ExampleService.java

@Service
@AllArgsConstructor
public class ExampleService{
    private final ExampleRepository repository;
    private final ExampleMapper exampleMapper;

    public List<ExampleDTO> findAll(){
        return this.exampleMapper.map(this.repository.findAll());
    }
}

//ExampleView.java

@Route("")
public class ExampleView extends VerticalLayout{
    private final ExampleRepository exampleRepository;

    public ExampleView(ExampleRepository exampleRepository){
        this.exampleRepository = exampleRepository;
        Div div = new Div();
        div.add(myGrid());
        
        add(div);
    }

    private Component myGrid(){
        var grid = new Grid<>(ExampleDTO.class);
        grid.setColumns("aaa", "bbb", "ccc");
        grid.setItems(VaadingSpringDataHelpers.fromPagingRepository(exampleRepository)); //Here i get an error

        return grid;

    }
}

The helper simplifies lazy loading and other stuff, which you aren’t using in your service anyway (findAll) - therefore it’s safe to just remove that call.

grid.setItems(service.findAll());

If you need lazy loading and wanna use your DTOs, take a look at the helper class and re-implement it yourself, it’s literally 5 lines of code.

Could you please send me how this “helper class” should look like? The code I uploaded I wrote a while ago as an example, the application itself is “quite a lot” bigger, and the table from which I retrieve has more than 7 million records, so I need such a mechanism that will make it possible.

Is there a more elegant option besides writing this class from scratch?

Nope, you do custom DTO - you do custom code ;)