Spring Data repository with empty IN clause.

The problem I’ve stabled upon started with a spring data repository like this: public interface SampleRepository extends CrudRepository<Sample, Integer>{ @Query("select s from Sample s where s.id in :ids") List<Sample> queryIn(@Param("ids") List<Integer> ids); } Actual query was of course more complicated that this. Complex enough to justify not using a query method. The problem emerges when you run this method with an empty collection as argument: repository.queryIn(Collections.emptyList()); The result is database dependent. [Read More]