From EPugh@upstate.com Fri Apr 11 11:41:36 2003 Return-Path: Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Delivered-To: mailing list torque-user@db.apache.org Received: (qmail 39770 invoked from network); 11 Apr 2003 11:41:36 -0000 Received: from unknown (HELO hqexch01.upstate.com) (205.160.101.145) by daedalus.apache.org with SMTP; 11 Apr 2003 11:41:36 -0000 Received: by hqexch01.upstate.com with Internet Mail Service (5.5.2653.19) id <2FZ0M7WG>; Fri, 11 Apr 2003 07:40:39 -0400 Message-ID: <4C47F66C98B28B4F903120350DEF05B06CB17C@hqexch01.upstate.com> From: EPugh@upstate.com To: torque-user@db.apache.org Subject: RE: SELECT TABLE.FIELD FROM TABLE. How do I do this? Date: Fri, 11 Apr 2003 07:40:36 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C3001F.2B6AEDC0" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N ------_=_NextPart_001_01C3001F.2B6AEDC0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable do BasePeer.executeQuery("SELECT TABLE.FIELD FROM TABLE") and then you get back village record objects! -----Original Message----- From: Ricardo Lecheta [mailto:ricardolecheta@brturbo.com] Sent: Friday, April 11, 2003 12:57 AM To: torque-user@db.apache.or Subject: SELECT TABLE.FIELD FROM TABLE. How do I do this? This is my table: CREATE TABLE PESSOA ( id INTEGER NOT NULL, nome VARCHAR (50) NOT NULL, fone VARCHAR (50) NOT NULL, PRIMARY KEY(id) ); I would like to do a sql statement like the following one: SELECT TABLE.FIELD FROM TABLE // only a field of the table but I can=B4t. I tried to do it like this: Criteria c =3D new Criteria(); c.addSelectColumn(PessoaPeer.NOME); PessoaPeer.doSelect(c); SQL Statement generated by Torque: Current Query SQL (may not be = complete or applicable): SELECT PESSOA.NOME FROM PESSOA the sql statement is correct, but the following mistake occurs: com.workingdogs.village.DataSetException: Bad conversion: java.lang.NumberFormatException: For input string: "Ricardo" I have noticed that this is happening because Torque doesn=B4t = understand I want to select only one field of the table. So, on method populateObject(...) of BasePessoaPeer Class, Torque tries = to recuperate fields that didn=B4t appear on my research. try{ obj.setId(row.getValue(offset + 0).asInt()); // INVALID TYPECAST, = this field doesn=B4t exist in my query. obj.setNome(row.getValue(offset + 1).asString()); obj.setFone(row.getValue(offset + 2).asString()); } catch (DataSetException e){ throw new TorqueException(e); // THIS EXCPETION IS RAISED } Could you please tell me the right way to do it ? Thank you Ricardo. ------_=_NextPart_001_01C3001F.2B6AEDC0--