Richard

I try to select only 1 column from a table using the peer object method DoSelect()
I've try:
      Criteria crit = new Criteria();
      crit.addSelectColumn(mainProductPeer.MAIN_PRODUCT_SEQID);
      List SeqIDList = mainProductPeer.doSelect(crit);

I receive an Exception :
     com.workingdogs.village.DataSetException: Only 1 columns exist!

Is it possible do this with Torque peer object?

I'm not sure. I've never done this myself. I just tried a similar select to try to help you, but it failed as well. I'm guessing that Torque is trying to turn the query into a List of *complete* objects, but since only one column exists, it fails to set all the properties of the objects. I'm going to ask about the intended use of addSelectColumn.


If not is there another solution ?

I believe the other solution would be to use doSelectVillageRecords instead of doSelect. That will return a List of com.workingdogs.village.Record. So, to get a List of what you actually want, you could do the following.


Criteria crit = new Criteria();
crit.addSelectColumn(mainProductPeer.MAIN_PRODUCT_SEQID);
List villageList = mainProductPeer.doSelectVillageRecords(crit);
List SeqIDList = new Vector();
Iterator it = villageList.iterator();
while (it.hasNext())
{
    SeqIDList.add(new Integer(it.next().getValue(1).asInt()));
}

Note that Village records are 1-based, not 0-based, which is why you use getValue(1) instead of getValue(0). Also, the above gives you a List of Integer; use whatever you need.

Eric


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to