How to write in Hibernate perspective for the following sql query,
select * from PList where owner = "user" or groupId in ("group 1","group 2",group3" ) order by owner ,group;
I have table with
Quote:
Plist with column (id,type,name,owner,bid,createdate,groupId)
and
Group with column (groupId,name,desc,createdate,createby).
Here groupId is Foreign Key.
I tried something as,
Code:
String queryString = "from Plist play where play.owner = :key " +
" and play.type = :str " + "and gprid =Group.groupId" +
" and play.bid = :brn order by owner,groupId;
queryObject = getSession().createQuery(queryString);
queryObject.setLong("brn", bran);
queryObject.setParameterList("gprid", (Collection) groupIds);
queryObject.setString("key", user);
queryObject.setString("str", type);
I will pass to this query string with values ( bran = 1 ,groupIds = [1,2,3],user = srins,type='t').
How to rewrite my query according to the select statement which i have mentioned above.
ie,
select * from PList where owner = "user" or groupId in ("group 1","group 2",group3" ) order by owner ,groupId;
Can anyone help me in this regard.
Thanks,
srins.