-
1. Re: select count(*) from table
jmschust Apr 1, 2002 6:17 PM (in response to lasterra)That's not really how CMP's work. Just make a BMP instead, it'll be small, and to be quite honest, there will be less lines of code than a CMP if you include descriptors.
-
2. Re: select count(*) from table
jmschust Apr 1, 2002 6:18 PM (in response to lasterra)Oh, another option if you already have CMPs defined for that table is to create a Home method in the CMP. This can just be count incrementor for every load... it's in the 2.0 spec.
-
3. Re: select count(*) from table
lasterra Apr 2, 2002 9:20 PM (in response to lasterra)i don't understand the second suggestion.
Can you explain it better?
Thank you very much.
Regards, Enrique. -
4. Re: select count(*) from table
jmschust Apr 22, 2002 3:21 PM (in response to lasterra)A home method in a entity bean is a method in a object instance that is not associated with a specific primary key yet (or ever). Finder methods are like this.
What you can do is create a singleton, accessable from a home method, that can do one of two things. One, simply keep a value that gets incremented by the entity on every create (therefore in essance counting the number of rows), or that uses some QL call against the beans to get the count (in which case you wouldn't need the singleton) which in essance would just be another finder method, with a select (*) in it.