Return-Path: Delivered-To: apmail-db-torque-user-archive@db.apache.org Received: (qmail 84240 invoked by uid 500); 30 Jul 2003 16:50:44 -0000 Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Apache Torque Users List" Reply-To: "Apache Torque Users List" Delivered-To: mailing list torque-user@db.apache.org Received: (qmail 84224 invoked from network); 30 Jul 2003 16:50:43 -0000 Received: from secfw12.sec.gov (12.40.163.231) by daedalus.apache.org with SMTP; 30 Jul 2003 16:50:43 -0000 Received: by secfw12.sec.gov; id h6UGohB22943; Wed, 30 Jul 2003 12:50:43 -0400 Received: from exchange2.sec.gov(162.138.65.52) by secfw12.sec.gov via smap id xma022595; Wed, 30 Jul 03 12:49:52 -0400 Received: by opc-sec-mt1.sec.gov with Internet Mail Service (5.5.2653.19) id <346AW9VA>; Wed, 30 Jul 2003 12:50:56 -0400 Message-ID: From: "Keeney, Thomas" To: "'Apache Torque Users List'" Subject: RE: How to do when i want to query like "select * from book where book.name like 'TCP' "? Date: Wed, 30 Jul 2003 12:50:50 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Cast the second method parameter to an Object: crit1.add(BookPeer.TITLE, (Object)"TCP", Criteria.LIKE); The problem is that there is another Criteria.add() method that takes a String as the second parameter, but this String represents the column = name and not its' value. See the Criteria javadocs. Best of luck! Tom -----Original Message----- From: sailorhero [mailto:sailorhero@hotmail.com] Sent: Wednesday, July 30, 2003 12:32 PM To: Apache Torque Users List Subject: Re: How to do when i want to query like "select * from book = where book.name like 'TCP' "? I has used method which is like that you say. but there is error in compileing this line when i work at eclipse. code : Criteria crit1 =3D new Criteria(); crit1.add(BookPeer.TITLE, "TCP", Criteria.LIKE); List results =3D BookPeer.doSelect(crit1); java.lang.Error: = =CE=DE=B7=A8=BD=E2=CE=F6=B5=C4=B1=E0=D2=EB=CE=CA=CC=E2=A3=BA =B7=BD=B7=A8 add=A3=A8String, Object, = SqlEnum=A3=A9=B6=D4=D3=DA=C0=E0=D0=CD Criteria =D3=D0=C6=E7=D2=E5 at com.kazmier.BookStore.main(BookStore.java:76) Exception in thread "main"=20 ----- Original Message -----=20 From: "Keeney, Thomas" To: "'Apache Torque Users List'" Sent: Wednesday, July 30, 2003 12:52 AM Subject: RE: How to do when i want to query like "select * from book = where book.name like 'TCP' "? > Try something like this, >=20 > Criteria crit =3D new Criteria(); > crit.add(bookPeer.NAME, 'TCP', Criteria.LIKE); > List results =3D bookPeer.doSelect(crit); >=20 > Regards, > Tom >=20 > -----Original Message----- > From: sailorhero [mailto:sailorhero@hotmail.com] > Sent: Tuesday, July 29, 2003 10:23 AM > To: torque-user@db.apache.org > Subject: How to do when i want to query like "select * from book = where book. > name like 'TCP' "? >=20 >=20 > I used toruqe at Mssql database. > I want to query something like this SQL : >=20 > select * from book where book.name like 'TCP'=20 >=20 > but how to use torque to query this? >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org > For additional commands, e-mail: torque-user-help@db.apache.org >=20 >=20 --------------------------------------------------------------------- To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org For additional commands, e-mail: torque-user-help@db.apache.org