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
-
Scrolling large result sets... (2 messages)
- Posted by: xxx xxx
- Posted on: September 12 2001 13:09 EDT
Threaded Messages (2)
- Scrolling large result sets... by song xiaofei on September 14 2001 04:04 EDT
- Scrolling large result sets... by Gal Binyamini on September 14 2001 19:18 EDT
-
Scrolling large result sets...[ Go to top ]
- Posted by: song xiaofei
- Posted on: September 14 2001 04:04 EDT
- in response to xxx xxx
i think you'd better try using session beans... -
Scrolling large result sets...[ Go to top ]
- Posted by: Gal Binyamini
- Posted on: September 14 2001 19:18 EDT
- in response to xxx xxx
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.
Gal