When using the , we need to specify the size parameter, and if, when loading the collections of the passed ids, more than the specified size, then several queries will be executed. To improve performance, it would be better if additional queries were not created. For this, the best option would be if additional requests with received ids returned all the required result. How about creating an annotation of similar functionality (example @AllLoadable)that would not accept a size and the request could be like:
select * from client c where c.id in (select unnest(array [1, 2, 3, 4]))
|