java.util.List findByHql(java.lang.String hqlstr,
int startindex,
int count)
根据HQL语句,查询所有符合条件的po对象集合.
参数:
hqlstr
- 标准HQL语句
startindex
- 查询起始位置,查询全部时填写-1
count
- 从起始位置开始的查询数量,查询全部时填写-1
返回:
返回po对象集合
public List findByHql(final String hql,final int startindex,final int count) {
Query query = sessionFactory.getCurrentSession().createQuery(hql);
if(startindex>=0 && count>=0){
query.setFirstResult(startindex);
query.setMaxResults(count);
}
return query.list();
}