Queries against to-many relationships with 'NOT' subexpressions

From: Victor Antonovich (v.antonovic..mail.com)
Date: Tue Aug 24 2010 - 11:05:50 UTC

  • Next message: Aristedes Maniatis: "Re: Queries against to-many relationships with 'NOT' subexpressions"

    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:

    ((a.name='Active') and (not (a.name='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.



    This archive was generated by hypermail 2.0.0 : Tue Aug 24 2010 - 11:06:45 UTC