MySQL ストアド プロシージャがあります。ストアド プロシージャについてはここをクリックし、 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
注:コードから以下のステートメントを削除すると、すべてのレコードが単一の jsp ページに表示されます。
query.setMaxResults(ps);
誰でも問題の解決策を教えてもらえますか?
ありがとう...