Re: Java Client RawRows Query
Re: Java Client RawRows Query
- Subject: Re: Java Client RawRows Query
- From: Florijan Stamenkovic <email@hidden>
- Date: Mon, 28 Apr 2008 10:55:23 -0400
On Apr 28, 2008, at 07:02, David Avendasora wrote:
Hi Neil,
In addition to what Flor is suggesting, you can use key-path
constructs to sum values as well as doing RMI (stateless or
stateful). A key-path example would be:
valueForKeyPath("email@hiddenbute")
Note however that this only works when you need to sum something in
an relationship. If I understand Neil's SQL well, he is summing up
something from all of the records of the "tickets" table. Though I
must say that "SELECT sum(*) AS overallTotal FROM tickets" is
somewhat confusing to me, but then again my SQL is rusty... Neil,
what exactly are you summing up?
Anyway, KVC can be used also for that, I believe like this:
NSArray tickets = ec.objectsWithFetchSpec...
Object sum = tickets.valueForKeyPath("@sum.attribute");
I've never done this, but believe it should work. This will do all
the work on in Java (server or client, wherever you put the code).
Now, what this is going to do is retrieve all the EOs from the
server then iterate through them on the client and sum the
"attributeToSum" and return that value. So this one command does a
_lot_ of EO work (ain't WO great?). If there are a lot of EOs in
the relationship and you don't need all of them on the client for
other things, then you should probably perform this in the server-
side class instead of the client-side one. The way I normally do
this is using regular stateful Remote Method Invocation that is
built into every EO.
Are you sure of this? I know EOF is tuned not to fire the fault for a
to-many relationship when asked for a @count of objects in it, the
same optimization could be done for @sum, though yes, that would be
more complicated. Hm, I'll post a general list question on this...
PS OSX10.5/WO5.3/MySQL5/Eclipse/WOLips/No_Wonder (but have it
installed -- can I use it with JavaClient?)
Sorry Neil, have not seen this before. This has long been on my to-do
list, seeing what parts of WOnder can be integrated into JC
(specifically I refer to the client side), as I am sure some could
be. Unfortunately, I didn't have the time to get into it, and it will
be a while before I do have the time... Maybe someone else has been
working on this???
F
_______________________________________________
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