db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sgarlata Matt" <sgarlata_m...@bah.com>
Subject Re: How to do when i want to query like "select * from book where book.name like 'TCP' "?
Date Wed, 30 Jul 2003 18:37:59 GMT
Try this:

Criteria crit2 = new Criteria();
crit2.add("BOOK.TITLE", (Object)"%TCP%", Criteria.LIKE);

I think Torque only puts in LIKE if you actually use wildcards in your
query.  Otherwise Torque uses =.
----- Original Message ----- 
From: "sailorhero" <sailorhero@hotmail.com>
To: "Apache Torque Users List" <torque-user@db.apache.org>
Sent: Wednesday, July 30, 2003 2:33 PM
Subject: Re: How to do when i want to query like "select * from book where
book.name like 'TCP' "?


> I think I find  a bug.
> I used the torque 3.0.2.
> when I used the second method ,but the result of query is wrong.
> I open the log4j in debug mode.
> I find the SQL query is wrong .
> code:
>    Criteria crit2 = new Criteria();
>    crit2.add("BOOK.TITLE", (Object)"TCP", Criteria.LIKE);
>
>    List results = BookPeer.doSelect(crit2);
>    printBooklist(results);
> The log4j is like this.
> DEBUG [main] util.BasePeer (createQueryString:994) - SELECT book.BOOK_ID,
book.TITLE, book.ISBN, book.TIME, book.PUBLISHER_ID, book.AUTHOR_ID FROM
book, BOOK WHERE BOOK.TITLE = 'TCP'
> DEBUG [main] util.BasePeer (executeQuery:1532) - Elapsed time=0 ms


---------------------------------------------------------------------
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