You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by armdev <ar...@gmail.com> on 2010/02/04 10:46:58 UTC
Re: How to write it in JPQL
JPQL limit
Query query = null;
List<Integer> rows;
Integer count = 15;
String query_string = "SELECT c.id FROM NewsEntity c ORDER BY RAND()";
query = em.createQuery(query_string);
query = em.createQuery(query_string);
if (count != null && count > 0) {
query.setMaxResults(count);
}
rows = query.getResultList();
-----------------
Its full answer, enjoy!!!
--
View this message in context: http://n2.nabble.com/How-to-write-it-in-JPQL-tp211564p4512489.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.