Is there a way to properly bind to a set in a form?
I am doing a POJO binding and my controller accepts a User object
public static void create(User user)
user.java
public class User implements Serializable {
public Long id;
@Required
@Email
public String email;
public Set<Group> groups;
}
Group.java
public class Group implements Serializable {
public Long id;
public String name;
}
I can't make my field snap to groups
I tried user.groups []. id, user.groups [0] .id, user.groups.id. I can make it work with the list just fine, but when it posts, I get a list of N elements with a bunch of zero elements (one zero for each checkbox that was not checked), and I could just create a new list without zeros but it seems wrong.
Edit: The user and group are not intended for permanent objects, Play simply acts as a level of a stagnant and constant level for a calm API