db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Zhao" <wzhao6...@gmail.com>
Subject Re: retrieve columns returned by doSelect(Criteria) query
Date Sat, 16 Dec 2006 01:35:49 GMT
Thanks Shane, actually, I found criteria.getSelectColumns() is what I needed.

David

On 12/14/06, Shane Beasley <sbeasley@acm.org> wrote:
> David Zhao wrote:
>
> >  If I did this:
> >
> >  Criteria crit = new Criteria(); crit.addJoin(Table1Peer.ID1,
> >  Table2Peer.ID2, Criteria.INNER_JOIN );
> >  crit.addSelectColumn(Table1Peer.ID1);
> >  crit.addSelectColumn(Table2Peer.NAME);
> >  crit.addSelectColumn(Table2Peer.NOTES); List list = null; try { list
> >  = BasePeer.doSelect(crit); } catch (Exception e) { Log.error("Error
> >  runnnnning query: " + e.getMessage()); }
> >
> >  How can I retrieve the list of columns returned by the query?
>
> //
> http://www.softwareforge.de/projects/village/apidocs/com/workingdogs/village/Record.html
> //
> http://www.softwareforge.de/projects/village/apidocs/com/workingdogs/village/Value.html
>
> import com.workingdogs.village.Record;
> import com.workingdogs.village.Value;
>
> final List<Record> records = BasePeer.doSelect(crit);
>
> for (final Record record : records) {
>   final Value v_id1 = record.get(1);
>   final int id1 = v_id1.asInt();
>   final Value v_name = record.get(2);
>   final String name = v_name.asString();
>   // ...
> }
>
> Shane
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message