Java Client RawRows Query
Java Client RawRows Query
- Subject: Java Client RawRows Query
- From: Neil MacLennan <email@hidden>
- Date: Sun, 27 Apr 2008 22:00:08 +0100
I'm running a JavaClient application (and surprised how easy it is to
connect to my EOModel on the server :-) Thanks to Florijan's
walkthrough [http://web.mac.com/flor385/eSwamp/software/wojc_tutorial.html
]).
I'm trying to run a simple SQL query that performs a SQL sum on a
table, and I thought of using EOUtilities.rawRowsForSQL to do this
read operation rather than return a full set of EOs and sum them in
code. However I got this error:
[AWT-EventQueue-0] DEBUG uk.org.cwwresources.TicketSearch - An error
occurred: modelGroup: an EOEditingContext's root object store must be
an EOObjectStoreCoordinator for this method to function.
java.lang.IllegalArgumentException: modelGroup: an EOEditingContext's
root object store must be an EOObjectStoreCoordinator for this method
to function.
at com.webobjects.eoaccess.EOUtilities.modelGroup(EOUtilities.java:
1004)
at
com
.webobjects
.eoaccess.EOUtilities.databaseContextForModelNamed(EOUtilities.java:766)
at com.webobjects.eoaccess.EOUtilities.rawRowsForSQL(EOUtilities.java:
547)
at
uk.org.cwwresources.TicketSearch.fetchCountTallies(TicketSearch.java:
125)
at uk.org.cwwresources.ScanIt$1.actionPerformed(ScanIt.java:80)
at javax.swing.Timer.fireActionPerformed(Timer.java:271)
at javax.swing.Timer$DoPostEvent.run(Timer.java:201)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at
java
.awt
.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:
269)
at
java
.awt
.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:
190)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:
184)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:
176)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
The calling code was:
EOEditingContext ec = new EOEditingContext();
String sql = "SELECT sum(*) AS overallTotal FROM tickets";
NSArray result1 = EOUtilities.rawRowsForSQL(ec,"Shop", sql, null);
I know that my JC<->Server link is working as I can retrieve EOs fine
in another method in the same class.
What I don't know is (i) whether or not this is "fixable"/"possible"
and if it is I don't have enough knowledge to fix it; and (ii) is
there an alternative way to access something like "SELECT sum(*) AS
overallTotal FROM tickets" using JavaClient and EOs or otherwise.
Thanks in advance for any pointers...
.neilmac
PS OSX10.5/WO5.3/MySQL5/Eclipse/WOLips/No_Wonder (but have it
installed -- can I use it with JavaClient?)
_______________________________________________
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