How to restrict no. of beans returned by finder method


EJB programming & troubleshooting: How to restrict no. of beans returned by finder method

  1. I am using a entity bean developed by my colleague. It has a finder method in Home interface which returns an Enumeration. The problem is if I pass a particular value to that method it will satify more than 50000 rows of the database. Will it create that no. of EJBObject and beans. If yes then it will create a huge memory load on Application server. Is there a way where I can restrict the Application server not to create more than a fixed no. of beans.

  2. One way that I can think of is to use BMP for the entity bean. That way, you have direct control at the SQL level and you can restrict number of rows returned from the query.

  3. Atleast in weblogic, there's a way to restrict the number of beans directly thru CMP. if you want to handlimit the no. of beans , you could do it by specifying it in the xml deployment descriptor.

  4.  Hi,
    Could you give clarify where exactly you can specify the number of beans returned in the collection? What descriptor file and what elements?

  5. <max-beans-in-cache>XX</max-beans-in-cache>

    this is to be done in the weblogic_ejb_jar.xml file.