重複の可能性:
JPA を使用して上位 1 つの結果を選択
次のクエリを作成するときに、テーブル「MasterScrip」の「totalTradedVolume」フィールドに基づいて上位 10 件の結果を取得したいと考えています。
Collection<MasterScrip> sm=null;
sm=em.createQuery("select m from MasterScrip m where m.type = :type order by m.totalTradedVolume limit 2").setParameter("type", type).getResultList();
次の例外が発生します。
Caused by: java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Syntax error parsing the query [select m from MasterScrip m where m.type = :type order by m.totalTradedVolume limit 2], line 1, column 78: unexpected token [limit].
Internal Exception: NoViableAltException(80@[])
私のjpaクエリに何か問題があります。誰でも私を修正できますか?