3 Replies Latest reply on Jan 30, 2008 11:44 AM by Ragav Gomatam

    traversing through result

    Christopher Rivera Newbie

      Hi

      i have been looking for quite some while now for a solution to this problem.

      I have a table in my oracle database which has 2.000.000 (yes 2 million rows) and i need to process them one after the other

      we are using ejb 3.0 and if just try

      public List<Person> getList()
       {
       Query q = em.createQuery("from Person");
      
       return q.getResultList();
       }


      i get an out of memory error after 5 min of trying to load all the people :)

      how can i traverse through the result set

      something like:

       public void process(){
       // does not acutally work (JUST AN EXAMPLE)
       ResultSet s = em.createQuery("from Person");
      
       while (s.hasNext()){
       // so something
       }
       }
      


      Thank you very much