I am building a web application in Play! 1.2.5. I have a model class where one of the attributes is a Set collection of enums:
@Entity
@Table(name="AppUser")
public class User extends Model {
...
@Column(name = "industry_id")
@ElementCollection(targetClass = Industry.class)
@CollectionTable(name = "Industry", joinColumns = @JoinColumn(name = "AppUser_id"))
public Set<Industry> industries = new HashSet<Industry>();
}
The enum is:
public enum Industry {
Industry1,
Industry2
}
How exactly can I bind the industries collection to an edit template where the industries field is represented as a list of checkboxes, and their checking or unchecking adds them or removes them from the objects collection?
Thany you
You can bind your checkboxes like this
In my case it works on a model without JPA annotations but I guess it also work in your case