1
當調用MySQL存儲我有一個MySQL存儲過程click here for stored procedure,並呼籲使用Hibernate分頁不工作程序使用Hibernate
的過程Hibernate代碼:
int ps=5;
SQLQuery query=session2.createSQLQuery("CALL AbsentReportproc(:_fromdate,:_todate)");
query.setParameter("_fromdate", fromdate);
query.setParameter("_todate", todate);
query.setFirstResult(ps*(pno-1));
query.setMaxResults(ps);
List<Object[]> empList=query.list();
當我執行上面的代碼我顯示與以下錯誤消息:
org.hibernate.exception.SQLGrammarException: could not execute query
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'limit 5' at line 1
注意:如果我從代碼中刪除下面的語句,我DISPLA在單個jsp中記錄所有記錄Page
query.setMaxResults(ps);
任何人都可以給我解決方案是什麼問題?
謝謝...