Advertise with us

Our eBooks

How to limit the number of records in a Query with EJB 3.0 ?


Use the setMaxResults method from the Java persistence API Query


   private EntityManager em;

   private int maxRecords = 100;
   public void getNextItems() {
        Query q = em.createQuery("select object(o) from Item as o");
        items= q.getResultList();


© 2021 All Rights Reserved.

Please publish modules in offcanvas position.