Eric and Richard -- try this instead: mainProductPeer.doSelectVillageRecords(crit);
This will return a List of Record objects (see: com.workingdogs.village.Record) You can then return fields from the Record objects. Hope this helps. - Justin -----Original Message----- From: Eric Emminger [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 10:07 AM To: Turbine Torque Users List Cc: [EMAIL PROTECTED] Subject: Re: How to select only 1 column from a table? 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
