cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aristedes Maniatis <>
Subject Re: Queries against to-many relationships with 'NOT' subexpressions
Date Tue, 24 Aug 2010 12:05:37 GMT
You need to create an outer join.

On 24/08/10 9:05 PM, Victor Antonovich wrote:
> Hello!
> My (simplified) Cayenne scheme has two kind of objects - Role's and Group's with many-to-many
(flattened) relationships. Main task is to check is this Role member of some Group (i.e. 'Active')
while it is not member of another group (i.e. 'Admin'). Aliased query expression looks like:
> (('Active') and (not ('Admin')))
> where `a` is alias for `role.groups` to-many relationship to Group entities.
> But this query doesn't work as expected - roles in 'Admin' group will be returned. This
is because DB query with double-joined Group table selects record with self-joined 'Active'
group name.
> So question is simple - is there any way to do such queries?
> Thanks,
> Victor.

Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

View raw message