db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Keeney, Thomas" <Keen...@SEC.GOV>
Subject RE: How to do when i want to query like "select * from book where book.name like 'TCP' "?
Date Wed, 30 Jul 2003 16:50:50 GMT
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 = 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" <KeeneyT@SEC.GOV>
To: "'Apache Torque Users List'" <torque-user@db.apache.org>
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: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' "?
> 
> 
> 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: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message