Reputation: 8140
I'm trying to work at a Roles script in JSF. For my set-up I have the following JPA tags in the class UserType:
@ManyToMany
@JoinTable(name = "Usertype_Permissions",
joinColumns = {
@JoinColumn(name = "USERTYPE_ID", referencedColumnName = "id")},
inverseJoinColumns = {
@JoinColumn(name = "PERMISSION_ID", referencedColumnName = "id")})
public List<Permission> permissionList;
This creates an extra table in my database with the values.
Now, my question is, what is the best way to link this to a JSF page with checkboxes? I was thinking that only if a checkbox is ticked it is stored in the joined table "Usertype_Permissions" and if it is not ticked it isn't saved at all.
However, upon going to the page where I can setup the permissions I want to see the granted permissions (ticked and saved in "UserType_Permissions") and the ones that aren't granted (thus not saved).
Any hints/ideas how to accomplish this?
Upvotes: 0
Views: 553
Reputation: 8140
Best way was to put all the database login into my EJB and pass Lists of the Object through :-)
Upvotes: 1