1 Reply Latest reply on Jul 20, 2004 11:08 AM by Henk Schets

    findAll method with more than 1000 records

    Alexey Pismenskiy Newbie

      Hi All!
      My question is about design strategy.
      I have an Entity Bean, which data I should show to the client in list.
      I have a finder on that Entity Bean (findAll in home interface). When I have got a collection of entity beans from finder I create a collection of serializable Value Objects, which I return to client in session facade. The problem is the list is very large (more than 1000 record) and elapsed time is about 30-60 sec. and more. Client needs to see in list (for example) records from 1 to 50 or from 50 to 100 e.t.c and
      How can I limit row number in EJBQL, or I shuold use JDBC calls instead of EJBQL? How can I decrease time of method? Is it effective designed application when I use findAll method everytime when client needs to see a list?


        • 1. Re: findAll method with more than 1000 records
          Henk Schets Newbie


          you can do this by using Jboss specific sql.
          in your jbosscmp-jdbc.xml file, you can add something like :

          <jboss-ql><![CDATA[SELECT OBJECT(a) FROM table as a LIMIT ?1]]></jboss-ql>

          This is nicely documented in the free online documentation.
          Be aware that this overrides a method in your ejb-jar.xml ! So you must also have a query in your ejb-jar.xml file, but this one will be overriden by the query in your jbosscmp-jdbc.xml file.