Hi, can someone please assist!:
I have the following query, the problem is in the way I'm setting parameters for the query (eg. queryObject.setParameter), the query otherwise works well with a single parameter.
public Company findPopulatedCompanyByName(final
String name, final String name_other) {
HibernateCallback callback = new HibernateCallback(){
public Object doInHibernate(Session session) throws HibernateException, SQLException {
Company Company =null;
String query = "from Company g where g.name IN (?,?)";
Query queryObject = getHibernateTemplate().createQuery(session, query);
queryObject.setParameter(0, name);
queryObject.setParameter(1, name_other);
Company = (Company) queryObject.list().get(0);
Company.getUsers().size();
return Company;
}
};
return (Company) getHibernateTemplate().execute(callback);
}
Many thanks.