public List findByLikeOrderByDesc( final String hql, final String orderBy, final int firstRow, final int maxRow, final Object[] o) throws Exception ... { return getHibernateTemplate().executeFind(new HibernateCallback() ...{ public Object doInHibernate(Session s) throws HibernateException, SQLException ...{ Query query = s.createQuery(hql + "order by " + orderBy + " desc"); for (int i = 0; i < o.length; i++) ...{ query.setParameter(i, o[i].toString()); } query.setFirstResult(firstRow); query.setMaxResults(maxRow); List list = query.list(); return list; } }); }