String queryString = "SELECT boardList FROM BoardPrivileges AS boardPrivs " + "WHERE boardPrivs.userList = :user"; @Entity public class Users { @Id @GeneratedValue private Long id; private String type; // admin / teamlead / normal private String name; private boolean isAdmin; @ManyToOne private Companies company; @ManyToMany private Collection boardPrivilegsList = new ArrayList(); @Entity public class BoardPrivileges { @Id @GeneratedValue private Long id; @ManyToMany (mappedBy = "boardPrivilegsList") private Collection userList = new ArrayList(); @ManyToMany (mappedBy = "boardPrivilegesList") private Collection boardList = new ArrayList(); //This Board private boolean isCreater; //is creater of this board private boolean canRead; private boolean canUpdate; private boolean canDelete; @Entity public class Boards { @Id @GeneratedValue private Long id; private String title; private String description; @ManyToOne private Companies company; @ManyToMany private Collection boardPrivilegesList = new ArrayList();