Hi,
I'm trying to do a many to many relationship, however, my table has some persistent attributes.
Users (* id, name, login, password);
Roles (* id, description);
Permissions (* iduser, * idrole, candelete, canmodify, canupdate);
I wish to use Hibernate Annotations and I haven't find another way to do this except to create Permissions like a persistent class and set a Collection property to the User's persistent class.
Code:
public class User
{
public int id;
public String name;
public String login;
public String Password;
public List<Permission> Permissions;
}
public class Role
{
public int id;
public String Description;
}
public class Permission
{
public Role Role;
public Boolean CanModify;
public Boolean CanUpdate;
public Boolean CanDelete;
}
My Questions are:
How can I do this mapping?
There another way to do this with @ManyToMany Annotation?
thankful for any help