cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hugi Thordarson <h...@karlmenn.is>
Subject Re: Expression for checking if a to-many relationship contains an object
Date Sat, 26 Mar 2016 16:04:49 GMT
> On 25. mar. 2016, at 17:46, Andrus Adamchik <andrus@objectstyle.org> wrote:
> 
> 
>> On Mar 25, 2016, at 7:45 PM, Hugi Thordarson <hugi@karlmenn.is> wrote:
>> 
>> Hi all!
>> 
>> Subject says it all, really. How do I write an Expression to fetch all records where
a to-many relationship contains an object.
>> 
>> For example, let’s say a “Person” entity has a to-many relationship to an “Employment"
entity, which is then linked to a “Company” entity. And I want to fetch all “Person”
records that are linked to a certain company record.\
> 
> Something like "employments.company = $company" should work. This results in simple joins
across to-many, and should give you what you need.

Of course. Works like a charm, thanks!

- hugi
Mime
View raw message