cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Lamy <davel...@gmail.com>
Subject Re: Quick query question
Date Thu, 02 Apr 2009 18:36:22 GMT
Thanks guys.

I'm actually in the middle of putting together some code that will grab the
ObjEntity and use the getPrimaryKeyNames() method to get the name of the
PK.. then just create the expression using "db:" + pkName.  I'll let
everyone know how that goes.. if not great then I can back up to use this
instead.

Dave

On Thu, Apr 2, 2009 at 1:30 PM, Andrey Razumovsky <
razumovsky.andrey@gmail.com> wrote:

> This is possible. See
> http://cwiki.apache.org/CAY/mapping-primary-keys.html
> Also, as far as I know new modeler has checkbox option for auto-generating
> primary key attrs at reverse-engineering
>
> 2009/4/2 Dave Lamy <davelamy@gmail.com>
>
> > No, I didn't.. just did the standard Cayenne mapping with a database ID
> > column (auto-generated) which of course is not exposed in the Java class.
> > What makes this even more fun is that I'm using a generic persistent
> class
> > in several cases, so I don't have concrete Java classes/paths to work
> with.
> > Was hoping to use some sort of pseudo-path like Hibernate's ".id" field
> in
> > hql.
> >
> > So far the only real solution to this that I can see is to use a
> consistent
> > PK column naming scheme.. like "ID".. and then use a db:ID path
> expression.
> > But it's not ideal.
> >
> > On Thu, Apr 2, 2009 at 12:01 PM, Michael Gentry <mgentry@masslight.net
> > >wrote:
> >
> > > Did you map your primary key as a Java attribute?  If so, just include
> > it.
> > >
> > >
> > > On Thu, Apr 2, 2009 at 12:53 PM, Dave Lamy <davelamy@gmail.com> wrote:
> > > > I am composing a SelectQuery and want to include an expression to
> > narrow
> > > my
> > > > results based upon the primary key (just an int ID) as well as other
> > > > criteria.  I am using the ExpressionFactory to generate the
> > Expressions..
> > > > specifically I have
> > > >
> > > > Expression expr = ExpressionFactory.inExp(<pathToId?>, idCollection);
> > > >
> > > > Question is:  How do I represent the path to the primary key in an
> > > > expression string like this?
> > > >
> > > > Thanks--
> > > > Dave
> > > >
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message