首页 新闻 会员 周边

org.hibernate.exception.SQLGrammarException: could not extract ResultSet

0
悬赏园豆:5 [待解决问题]

实现分页的时候代码是

public List<BBS> getBBS(String sql){
ctx=new ClassPathXmlApplicationContext("applicationContext.xml");
sessionFactory=ctx.getBean("sessionFactory",SessionFactory.class);
Session session = sessionFactory.openSession();
Query query=session.createQuery("from BBS order by b_id desc");
query.setMaxResults(2);
query.setFirstResult(0);
List<BBS> list=query.list();
return list;
}

但是运行结果报错

org.hibernate.exception.SQLGrammarException: could not extract ResultSet

query.setMaxResults(2);
query.setFirstResult(0);
去掉之后,就好了,这要怎么解决啊?

干杯朵儿的主页 干杯朵儿 | 菜鸟二级 | 园豆:201
提问于:2015-05-24 17:24
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册