session.createSQLQuery(sql).setFirstResult(start).setMaxResults(limit).list();
Cannot use 'first', 'limit' or 'skip' in this context
难道hibernate不支持没有映射表的分页查询吗?
Cannot use 'first', 'limit' or 'skip' in this context
难道hibernate不支持没有映射表的分页查询吗?
调试欢乐多
用的union all
return (List<T>) this.getHibernateTemplate().execute(
new HibernateCallback() {
public Object doInHibernate(Session session)
throws HibernateException {
Query queryObject = session.createQuery(hql);
if (params != null && params.length!=0 ) {
for (int i = 0; i < params.length; i++) {
queryObject.setParameter(i, params[i]);
}
}
if (first > 0) {
queryObject.setFirstResult(first);
}
if (max > 0) {
queryObject.setMaxResults(max);
}
return queryObject.list();
}
}); }
2.可能是sql的问题,看下下面的解释。-944 Cannot use "first", "limit" or "skip" in this context.This statement uses FIRST N , LIMIT N or SKIP M inside a subquery. This action is not supported.Review the use of FIRST N and check that it is applied only to the outer main
query SELECT clause.
谢谢各位的解答