Hibernate version:2.1.1
Mapping documents:Xdoclet
Name and version of the database you are using:MySQL 4
I am trying to write a query which returns a list depending on the critieria I have entered. This query needs to be build dynamical depending on the number of arguments supplied. Can anyone help me how I should be constructing the query string.
Code:
public List getRightsForLicence(Licence licence, List rightsTypes) {
Object[] objects = new Object[2];
for(int i = 0; i<rightsTypes.size(); i++) {
RightsType rightsType = (RightsType)rightsTypes.get(i);
objects[0] = licence;
objects[1] = rightsType;
rights.addAll( getHibernateTemplate().find("from Rights r where r.licence=? and r.rightsType=?", objects) );
}
return rights;
}
I would just like to return a list of all the results as opposed to a list of results that contains separate lists of results.