You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by "skip@theDevers" <sk...@thedevers.org> on 2007/09/21 07:42:25 UTC
FindBy question
Can anyone tell me if any of the findBy methods using primary keys will
return matching records when only the first N bytes match?
For example, we have lots of GZ-xxxx in the demo Product table. Are there
any findBy methods that will return all if I do something like
List m = findByxxx("Product", UtilMisc.toMap("productId", "GZ");
I expect findByLike will do it, but I didnt want to do a "like" search where
I might bet back "AmGZ123" and similiar. I want to get back only records
starting with GZ.
I can dig through the source, but I was hoping some of the more experienced
folks could save me the trouble as I can't find documentation on it.
Skip
Re: FindBy question
Posted by Scott Gray <le...@gmail.com>.
Use the % wildcard
List m = findByLike("Product", UtilMisc.toMap("productId", "GZ%");
or you can use findByAnd with a list of expressions, there are plenty of
examples in the code to work from.
Regards
Scott
On 21/09/2007, skip@theDevers <sk...@thedevers.org> wrote:
>
> Can anyone tell me if any of the findBy methods using primary keys will
> return matching records when only the first N bytes match?
>
> For example, we have lots of GZ-xxxx in the demo Product table. Are there
> any findBy methods that will return all if I do something like
>
> List m = findByxxx("Product", UtilMisc.toMap("productId", "GZ");
>
> I expect findByLike will do it, but I didnt want to do a "like" search
> where
> I might bet back "AmGZ123" and similiar. I want to get back only records
> starting with GZ.
>
> I can dig through the source, but I was hoping some of the more
> experienced
> folks could save me the trouble as I can't find documentation on it.
>
> Skip
>
>