openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From armdev <armen.arzuman...@gmail.com>
Subject Re: How to write it in JPQL
Date Thu, 04 Feb 2010 09:46:58 GMT

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.

Mime
View raw message