I think the subject gives it all away, but let me re-iterate anyway.
I've had a look at the Criteria api and can't seem to find anything that I
could use to achieve
SELECT MIN(XXX) AS MIN FROM... or MAX(XXX) or GROUP BY...HAVING...
, UNION ....etc...for that matter.
Please excuse me if the answer is staring me in the face or I'm still
misunderstanding peers completely, but the only time I get to experiment with
Turbine is late at night when I'm a bit dozy...
I know I could do a normal doSelect(criteria) and then iterate through the
vector to get the min and max. (I'm answering my own question here ,
aren't I?)
If a straight and easy way of doing this is not possible using peers (because
the objects returned from doSelect are db table-mapped objects and none exist
for AS MIN), how do I run normal selects? I suppose by grabbing a connection
from the pool and using
DBConnection connection ...
Then using the villlage api directly....
Example from Village Api javadocs...
QueryDataSet qds = new QueryDataSet ( connection, "SELECT * from my_table" );
qds.fetchRecords(10); // fetch the first 10 records
for ( int i = 0; i < qds.size(); i++ )
{
Record rec = qds.getRecord(i);
int value = rec.getValue("column").asInt();
System.out.println ( "The value is: " + value );
}
qds.close();
So basically, when an SQL select statement is returning anything that can't
be mapped to the om objects generated by torque, you either
1. Analyse the SQL and use peers with code to achieve the resultset you want.
2. Use village to do straight select statements...etc...
I suppose I shouldn't really be needing to use staright SELECTS but until I
get up to speed with Peers, i need some quick funcionality.
I know I'm baffling on but I was just hoping for some guiding comments as I
wade through all of this and try to solve the 'simple problems' I have when
faced with peers.
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]