Hi Andrus,
How does your function help me create an expression using several primary
keys?
Expression exp1 = ExpressionFactory.matchExp(ItemType.ITEM_TYPE_ID_PK, 1);
Expression exp2 =
ExpressionFactory.matchExp(ItemProperty.ITEM_PROPERTY_ID_PK, 2);
Expression exp = exp1.andExp(exp2);
SelectQuery query = new SelectQuery(Item.class, exp);
List<Item> list = dataContext.performQuery(query);
The above won't work unless I map an ObjEntity to the DbEntity for the
primary key.
Dave
> -----Original Message-----
> From: Andrus Adamchik [mailto:andru..bjectstyle.org]
> Sent: 07 February 2006 16:25
> To: cayenne-use..bjectstyle.org
> Subject: Re: Query using foreign objects
>
>
>
> On Feb 7, 2006, at 11:20 AM, Dave Merrin wrote:
>
> > This is not for retrieving the primary key. It is for using the
> > primary key
> > in an expression.
>
> You can create a getter - it should work in expressions:
>
> public Object getId() {
> if(getpersistenceState == PersistenceState.NEW) {
> return null;
> }
> else {
> return pkForObject(this);
> }
> }
>
> Andrus
>
This archive was generated by hypermail 2.0.0 : Tue Feb 07 2006 - 11:56:20 EST