cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: Expression for checking if a to-many relationship contains an object
Date Fri, 25 Mar 2016 17:46:47 GMT

> 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.

Andrus


Mime
View raw message