limit
is not recognized in JPA. You can instead use the query.setMaxResults
method:
sm = em.createQuery("select m from MasterScrip m where m.type = :type
order by m.totalTradedVolume")
.setParameter("type", type)
.setMaxResults(2).getResultList()