Возможный дубликат:
Выберите 1 лучший результат с помощью JPAЯ хочу получить 10 лучших результатов на основе файла «totalTradedVolume» из моей таблицы «MasterScrip». когда я пишу следующий запрос:
Collection
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. Кто-нибудь может меня поправить?