java - HQL query filtering by @ManyToOne -
i have userclass has relationship roles:
@entity @table(name="users") @inheritance(strategy = inheritancetype.single_table) @discriminatorvalue("role_admin") @discriminatorcolumn (name="rolename", discriminatortype= discriminatortype.string, length=20) @discriminatoroptions(force = true) public class user extends baseentity implements userdetails { @manytoone @joincolumn(name = "role_id", referencedcolumnname="id") @notnull(message = "il campo ruolo รจ obbligatorio") private role role; //others fields //getter & setter }
in userdao, have insert / edit / delete ... function , 1 gives me users list:
@override @suppresswarnings("unchecked") public list<user> getusers() { return getcurrentsession().createquery("from user").list(); }
now question: build function gives me users have 1 of roles pass function:
public list<user> getusers(list<role> roles)
how can this? have pass list of ids, or it's pass list of roles?
in both cases, how can write the condition?
thanks
Comments
Post a Comment