Re: Using EO
Re: Using EO
- Subject: Re: Using EO
- From: Sacha Mallais <email@hidden>
- Date: Tue, 24 May 2005 20:19:22 -0700
On May 24, 2005, at 8:00 pm, Jonathan Miller wrote:
is there a way to build a FetchSpecification that would accomplish the
sql equivalent of "SELECT SUM(COLUMN_NAME) FROM TABLE_NAME"
I know you can select the objects and then add them using a java
enumeration but I was wondering if there is another way.
The most obvious is to construct the SQL yourself and send it directly
using the low-level EOF stuff (or even the JDBC stuff...). I mention
it because, as WO developers, we sometimes forget that there's SQL back
there ;-)
A more interesting (if not hackish...) way to accomplish this would be
to create a new entity with the same table name and a single derived
attribute of "sum(column_name)". You can then either generate a full
Java class for that or just use raw rows.
Also, the PracticalWO frameworks (and the GVC frameworks -- also to be
released soon, and, come to think about it, probably the ProjectWOnder
frameworks too...) have a helper method that makes aggregate queries
more simple.
HTH,
sacha
--
Sacha Michel Mallais - 400 lb. chimp
Global Village Consulting Inc.: http://www.global-village.net/
1. Never tell everything at once.
-- Ken Venturi, Ken Venturi's Two Great Rules of Life
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >Using EO (From: Jonathan Miller <email@hidden>) |