public List<User> getUserById(final int userId,final int maxCount,final int firstResult) throws Exception {
final String hql = "from User where userId=? ";
return this.getHibernateTemplate().executeFind(new HibernateCallback() {
public Object doInHibernate(final Session session) throws HibernateException, SQLException {
final Query query = session.createQuery(hql);
query.setParameter(0, userId);
query.setMaxResults(maxCount);
query.setFirstResult(firstResult);
return query.list();
}
});
}