JSF and type safety
问题 As I struggled for hours I finally found where those annoying ClassCastException s came from, which I thought were produced by Hibernate and it's enum -mapping. But they came from my JSF view, where I passed a List from <h:selectManyCheckbox value="#{createUserManager.user.roles}" ... > <f:selectItems value="#{createUserManager.roles}"/> </h:selectManyCheckbox> back into my backing bean. My data simply consists of the values of an enum: public Role[] getRoles() { return Role.values(); } . I