I have actually used both.
and from what I can see its just depends on your preference.
Let us know if it works for ya.
Joshua T. Pyle
On 5/24/05, Fredrik Liden <flide..ranslate.com> wrote:
> Thanks Joshua!! I forgot about the DB methods (never used them so far)
>
> Do you know if there are any pros and cons when it comes to using the 2
> different types of ExpressionFactory methods such as matchExp vs
> matchDbExp? (Besides that fact that the regular ones doesn't seem to
> support including the PKs as a search field like the db ones do).
>
> Also it seems more convenient to use ExpressionFactory.matchDbExp to get
> an object based on a pk (compound or not) compared to using the
> DataObjectUtils which would require one to create a map with the PKs?
>
> Fredrik
>
> -----Original Message-----
> From: Joshua Pyle [mailto:joshua.t.pyl..mail.com]
> Sent: Tuesday, May 24, 2005 4:34 PM
> To: cayenne-use..bjectstyle.org
> Subject: Re: Querying based on 1/2 the compound key
>
>
> What is the exception ?
>
> Most likely you will need to create a "db" epression if the 2 primary
> key fields do not have accessors defined in the modeler/xml.
>
> I also notice that in your expression you note KEY and not KEY1 or KEY2.
>
> An example expression might be...
> Expression exp = ExpressionFactory.matchDbExp(TEST.KEY2,"1111");
>
> This is assuming that the variable TEST.KEY2 contains the database field
> name for that part of the primary key.
>
> --
> Joshua T. Pyle
> Go has always existed.
>
>
> On 5/24/05, Fredrik Liden <flide..ranslate.com> wrote:
> > I have one table with a compound key (key1,key2).
> >
> > Now I'm trying to retreive all the entries from this table/object TEST
>
> > where say key2="1111".
> >
> > If I use an expression like this:
> > Expression exp = ExpressionFactory.matchExp(TEST.KEY,"1111");
> > SelectQuery query = new SelectQuery(TEST.class,exp);
> > I get an exception.
> >
> > Using the DataObjectUtils object I could probably get 1 unique object
> > if I populate it with a key map. But how can I get a list if I just
> > want to match one part of the compound key?
> >
> > Thanks,
> >
> > Fredrik
> >
>
-- Joshua T. Pyle Go has always existed.
This archive was generated by hypermail 2.0.0 : Tue May 24 2005 - 22:56:59 EDT