Robert,
I am attempting a test but lost you on your Qualifier step.
> SelectQuery query = new SelectQuery(Entity1.class);
This is easy.
> query.setQualifier(ExpressionFactory.matchExp(Entity1.EN|
> TITY2_PROPERTY,entity2));//where ENTITY2_PROPERTY is the name of
> object property in entity1 that points to entity2
I don't follow this step. You are obviously using the
ExpressionFactory to create a qualifier expression for the query but I
don't follow the match expression.
Lets say that entity1 is "Customer" and entity2 is "Detail". So the
code snippet would be
ExpressionFactory.matchExp(Customer.DETAIL_PROPERTY, entity2)
I don't understand what entity2 stands for in this example. In
addition, I am trying to select based on the contents of the entity2
field, so I am even more confused as to how this would accomplish that
objective.
> List<Entity1> e1 = objectContext.performQuery(query);//note: perform
> query is NOT generified, so you'll get a warning here.
This seems easy as well.
Thanks,
Joe
On Mar 14, 2009, at 3:53 PM, Robert Zeigler wrote:
> Hi Joe,
>
> How about:
>
> SelectQuery query = new SelectQuery(Entity1.class);
> query.setQualifier(ExpressionFactory.matchExp(Entity1.EN|
> TITY2_PROPERTY,entity2));//where ENTITY2_PROPERTY is the name of
> object property in entity1 that points to entity2
> List<Entity1> e1 = objectContext.performQuery(query);//note: perform
> query is NOT generified, so you'll get a warning here.
>
> Robert
>
> On Mar 14, 2009, at 3/141:29 PM , Joe Baldwin wrote:
>
>> I am attempting to create the simplest Cayenne-expedient method of
>> doing the following query. (I can easily do this in SQL but am a
>> tad confused with the Cayenne Expression method.)
>>
>> I have an Entity (E1) with a one to one relationship with a second
>> entity (E2). I would like to perform a SELECT Query with a filter
>> on one of the fields of the relationship-entity (E2.F1) and return
>> a list of the first entity (E1List).
>>
>> What is the most efficient Cayenne way to do this? (I am still a
>> bit confused concerning how to construct efficient queries in the
>> object domain vs the relational domain.)
>>
>> Thanks,
>> Joe
>>
>>
>>
>
This archive was generated by hypermail 2.0.0 : Sat Mar 14 2009 - 17:23:10 EDT