Cayenne 3.0M4 supports outer joins. So you can match against NULL to
select objects with no targets over a given relationship. E.g. from
Cayenne tests:
SelectQuery missingToManyQuery = new SelectQuery(Artist.class);
missingToManyQuery.andQualifier(
ExpressionFactory.matchExp(Artist.GROUP_ARRAY_PROPERTY +
Entity.OUTER_JOIN_INDICATOR, null));
generates SQL like this:
SELECT DISTINCT t0.ARTIST_NAME, t0.ARTIST_ID, t0.DATE_OF_BIRTH
FROM ARTIST t0 LEFT JOIN ARTIST_GROUP t1 ON (t0.ARTIST_ID =
t1.ARTIST_ID)
WHERE t1.GROUP_ID IS NULL ORDER BY t0.ARTIST_NAME
Andrus
On Jun 16, 2008, at 9:44 PM, Scott Anderson wrote:
> Can anyone help with this?
>
> -----Original Message-----
> From: Scott Anderson [mailto:sanderso..irvana.com]
> Sent: Thursday, June 12, 2008 1:04 PM
> To: use..ayenne.apache.org
> Subject: Expression question
>
> What would be the best way to construct an expression which asserts
> that
> a flattened many-to-many relationship has no entries? Looking at
> methods
> in ExpressionFactory, nothing jumps out at me. I'm looking for rouged
> items in a hierarchy.
>
> Thanks,
> Scott
>
>
This archive was generated by hypermail 2.0.0 : Wed Jun 18 2008 - 13:00:06 EDT