Re: Using EO
Re: Using EO
- Subject: Re: Using EO
- From: Sacha Mallais <email@hidden>
- Date: Wed, 25 May 2005 00:37:25 -0700
On May 25, 2005, at 12:15 am, Jonathan Miller wrote:
Hmm... I guess my only question is which way has the best performance.
To answer my own question I would assume it to by passing raw SQL.
This is my first web site with WO and I was hoping I could avoid doing
that however(it's just too cool not to have to use SQL).
My preferred method is to use the NSArray @sum key value coding (note:
no need to do an enumeration). However, if you have many many values
to aggregate, then you're best bet is indeed raw SQL.
sacha
On May 24, 2005, at 5:19 PM, Sacha Mallais wrote:
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
--
Sacha Michel Mallais
President / Developer Extraodinaire
Global Village Consulting Inc. http://www.global-village.net/
The bird of paradise alights only upon the hand that does not grasp.
_______________________________________________
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>) |
| >Re: Using EO (From: Sacha Mallais <email@hidden>) |
| >Re: Using EO (From: Jonathan Miller <email@hidden>) |