Andrus, you deserve a medal.
Everything works better than I could have hoped!

Thank you so much,
Jack

Andrus Adamchik wrote:
Hi Jack,

I see this is on the right track now...

On Jul 21, 2007, at 1:15 AM, Jack O'Connor wrote:

java.lang.ClassCastException: org.objectstyle.cayenne.DataRow
at com.statistics.ComputeStatistics.getcsDiskSpace(ComputeStatistics.java:838)
    at com.statistics.MainStatistics.main(MainStatistics.java:66)

So you are casting the result to something else. Cast it to map:


List results = context.performQuery(....);
Iterator it = results.iterator();
while(it.hasNext()) {
   Map result = (Map) it.next();

   /// do something...
}

It recieved the correct number of rows (34), but when I try to access them, I get errors. I've tried using an arbitrary class, and creating a model in cayenne especially for the "show table status" table, with attributes "Data_length" etc, so I have the correct getters and setters, but no luck...

Is there a way to extract generic data form an undefined "Map"?

Yes - keys in the map are the column names from the ResultSet returned from MySQL. The simplest way to see what keys are valid is this:

   System.out.println("Keys: " + result.keySet());

So you can form instance use (but consult the output of the statement above for the correct key values)

   Number x = (Number) result.get("Data_length");

Andrus

Reply via email to