Hi,
With CMP entity beans, how can you do things like:
SELECT COUNT(*) FROM PRODUCTS
and
SELECT MAX(salary) FROM EMPLOYEES
I know I could write an ejbHome method that first calls a findAll() ejbFinder method, then calls size() on the returned collection to immitate a SELECT COUNT(*), or iterates through all elements of the collection to immitate a SELECT MAX(...), but both operation would be incredibly expensive compared to a true SQL call.
-
Count, Max, ... (2 messages)
- Posted by: Koen Rousseau
- Posted on: September 15 2002 03:48 EDT
Threaded Messages (2)
- Count, Max, ... by Eric Ma on September 15 2002 18:09 EDT
- Count, Max, ... by hoi tsang on September 16 2002 02:56 EDT
-
Count, Max, ...[ Go to top ]
- Posted by: Eric Ma
- Posted on: September 15 2002 18:09 EDT
- in response to Koen Rousseau
Why does your home method have to finadAll()? It can make COUNT(*) SQL calls directly. For all intents and purposes, home methods in entity beans are the same as regular methods in stateless session beans. -
Count, Max, ...[ Go to top ]
- Posted by: hoi tsang
- Posted on: September 16 2002 02:56 EDT
- in response to Eric Ma
agree... sometime i think it's why we don't do all these extra SQL works in the *Home* rather than putting them into the session bean... i see it adding some extra work to do that..