Scrolling large result sets...


Performance and scalability: Scrolling large result sets...

  1. Scrolling large result sets... (2 messages)

    I'm a bit of a newcomer to ejb technology, and am looking for solutions to the following rather basic problems...

    (i) Does a finder method in CMP always have fetch the complete result set ? This would be risky when you've got very large database tables

    (ii) Is it possible to "scroll" the results of a finder method in CMP ? Typically I would like to create an application allowing the user to scroll ( next page, previous page ) through a potentially large entity/database table

    (iii) How do you implement "dynamic" filters in EJBs. Typcially the user will enter a set of filter conditions in a web mask, and the application will have filter the Entity Beans accordingly ?

    (iv) How do you change the sort criteria in Entity beans at runtime ? ( SELECT FROM .... ORDER BY ??? )

    Many thanx

    Threaded Messages (2)

  2. Scrolling large result sets...[ Go to top ]

    i think you'd better try using session beans...
  3. Scrolling large result sets...[ Go to top ]

    Entity beans are pretty weak when it comes to mass-reporting and formatting. They are best used when there is a limited amount of information to which access must be transactional.
    In cases of mass-reporting, such as showing search results, I'd use session beans, or taglibs. If you write a reasonably generic DAO, you may not to rewrite a lot of code.

    Specifically regarding problem (i):
    A finder in BMP only has to fetch the primary keys. A finder in CMP is probably "optimized" in the same manner (depending on your App server).
    An App server doesn't have to load the entity bean until a client actually calls it, so an optimized App server can only fetch what the client needs (although it may fetch in chunks to optimize DB access). All App servers I know do this.
    As for (ii), you can keep the Collection a finder returned somewhwere (session bean, HTTP session) and scroll through it.

    However, problems (iii) and (iiii) have no simple solution in CMP. You can implement them in BMP by passing the search and ordering criteria to the finder, but I wouldn't go to that trouble. Entity beans don't give you everything significant here, and will probably hurt performance.