Hi and thanks,

Well both, modeler and code (just for my cayenne understanding...)
And in the modeler ?

Arnaud

2010/4/18 Joe Baldwin <jfbald...@earthlink.net>

> Arnaud,
>
> If I understand you, I think you want to do this in the code and not the
> modeler?
>
> Here is a simple code fragment for a like-ignore-case qualifier:
>
>        String substring = "Martin";
>        ObjectContext oc = BaseContext.getThreadObjectContext();
>        Expression exp =
> ExpressionFactory.likeIgnoreCaseExp(Product.NAME_PROPERTY, ("%" + substring
> + "%"));
>        SelectQuery query = new SelectQuery(Product.class, exp);
>        List list = oc.performQuery(query);
>        System.out.println("\ncount: " + list.size());
>
> This is pretty efficient and to my knowledge does not trigger any
> DataObject faults.  There are a few other ways to do this depending on your
> design.  The ExpresionFactory has a lot of powerful methods to help you out.
>
> Joe
>
>
>
>
> On Apr 18, 2010, at 12:15 PM, Arnaud Garcia wrote:
>
> > Hello,
> >
> > I am not sure how to create a select count(*) in the modeler when I need
> to
> > pass a parameter ?
> > I downloaded the petstore example, and it seems that I have to create a
> "Raw
> > SQL" Query, and directly write my select count(*)...
> >
> > =>but how to I had my parameter in my SQL ?
> >
> > ... then I suppose I can do ctxt.performQuery("myCount",params,true) ?
> >
> > thanks for help for this beginner question...
> >
> > Arnaud
>
>

Reply via email to