Value class + spring + JPA @Query

Having this piece of code (simplified):

Value class:

value class Foo(val value: String)


class Bar {
  var id: Long = 0L
  var foo: Foo = Foo("")


interface BarRepository : JpaRepository<Bar, Long> {

  @Query("select b from Bar b where = :foo")
  fun findByFoo(foo: Foo): List<Bar>

  @Query("select b from Bar b where in (:fooList)")
  fun findByFooIn(fooList: List<Foo>): List<Bar>

The first query will work, but the other one will fail with JPA complaining that it was expecting a list of String-s, but got a list of Foo-s.

If I change the signature so that fooList becomes List (and map input to list of strings) it works, but of course, then I will lose type checking.

My question is why does it work with a single item, but fails with a list, and if anyone is aware of a workaround (other than using strings explicitly).