Cannot validate a Form<User> with array fields

I’ve a User model with a @ManyToMany relation. I want to submit a form with an array of IDs but the validation returns an error.

public class User extends Model {

  @ManyToMany
  private List<Stock> stocks;

  public List<Stock> getStocks() {
    return stocks;
  }

  public void setStocks(List<Long> stockIds) {
    stocks = (stockIds == null) ? null : stockIds.stream().map(Stock::getById).collect(Collectors.toList());
  }

}

In my HTML:

<select name="stocks[]" class="form-control" multiple>
  <option value="1">Test</option>
</select>

In my Controller:


Form<User> form = formFactory.form(User.class).bindFromRequest();

if (form.hasErrors()) {
  System.out.println(form);
}

The output gives me:
Form(of=class models.User, data={stocks[0]=1}, value=Optional[models.User@2], errors={stocks[0]=[ValidationError(stocks[0],[error.invalid],[])]})

Any idea why?