6 Replies Latest reply on Nov 14, 2001 8:37 PM by hamish carpenter

    finding only a limited number of beans

    Christoph Jäger Newbie

      I am using EJB1.1 CMP Entity Beans. I want to create a finder method, which returns only a limited number of beans.

      I created a custom finder method returning a collection of primary keys. The finder method takes two arguments, start and count, called ejbFindRangeSortedByName(int start, int count) in the EJB (with corresponding findRangeSortedByName(int start, int count) in the Home Interface.

      When I call findRangeSortedByName(int start, int count) the corresponding ejbfindRange...() never gets called. I just get an empty Collection, no warning or message of any kind in the logfile.

      Now I got two questions:

      1. Is it possible to write custom finders for CMP EJBs (not defined in jaws.xml, but coded in the EJB) for queries, that I can not define in a jaws.xml file (or do I have to use BMP EJBs for this purpose)?

      2. What is the best (database independent) way to implement limited queries, returning a given maximum number of results (like for displaying result 10-20 for a search on a web page)? PostgreSQL defines a "LIMIT - OFFSET" clause for a select, but I want to stay database independent. Is it possible to define such finders with the EJB2.0 Query Language?

      Btw., I am using the JBoss2.4.1 - Tomcat3.2.3 bundle and a PostgreSQL database.

      Christoph