java - Querying associate table with HQL -
i have 2 entity class onetomany relationship:
@entity @xmlrootelement @dynamicinsert (value = true) @dynamicupdate (value = true) public class matchs { @id @generatedvalue private long matchid; private int size; @onetomany(fetch = fetchtype.lazy) @jointable(name = "match_users",joincolumns=@joincolumn(name="match_id"), inversejoincolumns=@joincolumn(name="user_id")) private list<user> users; //getters & setters } @entity @xmlrootelement @dynamicinsert (value = true) @dynamicupdate (value = true) public class user { @id private string username; private string lastname,firstname,password,email; private date dateofbirth; //getters & setters }
i want matchs particular user.this query:
matchs user.username=:username
this query throws org.hibernate.queryexception. how can accomplish hql.
you seems fetching data on column not exist in matchs
table. don't see column or relationship in matchs
class username
Comments
Post a Comment