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:[EMAIL PROTECTED] 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 = new Criteria(); crit1.add(BookPeer.TITLE, "TCP", Criteria.LIKE); List results = BookPeer.doSelect(crit1); java.lang.Error: 无法解析的编译问题: 方法 add(String, Object, SqlEnum)对于类型 Criteria 有歧义 at com.kazmier.BookStore.main(BookStore.java:76) Exception in thread "main" ----- Original Message ----- From: "Keeney, Thomas" <[EMAIL PROTECTED]> To: "'Apache Torque Users List'" <[EMAIL PROTECTED]> 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, > > Criteria crit = new Criteria(); > crit.add(bookPeer.NAME, 'TCP', Criteria.LIKE); > List results = bookPeer.doSelect(crit); > > Regards, > Tom > > -----Original Message----- > From: sailorhero [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 29, 2003 10:23 AM > To: [EMAIL PROTECTED] > Subject: How to do when i want to query like "select * from book where book. > name like 'TCP' "? > > > I used toruqe at Mssql database. > I want to query something like this SQL : > > select * from book where book.name like 'TCP' > > but how to use torque to query this? > > --------------------------------------------------------------------- > 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]
