You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by "Nase, Paul R." <Na...@mayo.edu> on 2004/02/19 19:14:34 UTC
Query with criteria - like using '%' or '_'
I would like to perform a query where a description could have a '%' or an '_'. Is this possible using QueryByCriteria?
Example:
ID DESCRIPTION
------- --------------------
10000 40% Member Discount
10001 Online Discount
I'd like to be able to search using a like statement similar to: "Where Description like '%\%%' ESCAPE '\'"
The current implementation will just strip off the escape character, resulting in passing my literal '\%' being pass as a wildcard.
Thanks in advance.
Paul Nase
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Query with criteria - like using '%' or '_'
Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi paul,
use addLike("your_attribute","P%")
hth
jakob
Nase, Paul R. wrote:
> I would like to perform a query where a description could have a '%' or an '_'. Is this possible using QueryByCriteria?
>
> Example:
> ID DESCRIPTION
> ------- --------------------
> 10000 40% Member Discount
> 10001 Online Discount
>
> I'd like to be able to search using a like statement similar to: "Where Description like '%\%%' ESCAPE '\'"
>
> The current implementation will just strip off the escape character, resulting in passing my literal '\%' being pass as a wildcard.
>
> Thanks in advance.
>
> Paul Nase
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org