It is a database thing, you need to model the relationship as an outer join.
Chuck On 2016-04-26, 9:45 AM, "[email protected] on behalf of OC" <[email protected] on behalf of [email protected]> wrote: >Hi there, > >I would need to fetch objects with qualifier > >=== >EOQualifier.qualifierWithQualifierFormat("owner.userType = %@ OR owner = >NULL",new NSArray(pc.userType)) >=== > >where "owner" is a :1 relationship based on C_OWNER_ID foreign key. That, >alas, does not work at all. It generates a SQL > >=== >SELECT ... FROM "T_COMPETENCE" t0, "T_USER" T1 WHERE (t0."C_OWNER_ID" is NULL >OR T1."C_USER_TYPE" = 9) AND t0."C_OWNER_ID" = T1."C_UID" >=== > >which never returns any row whose "owner"/C_OWNER_ID is NULL, for the latter >part of WHERE (AND t0."C_OWNER_ID" = T1."C_UID") prevents it. > >Is this a WebObjects bug or a database bug? > >Is there a way to write directly a qualifier which would work properly, i.e., >same way as my extremely ugly work-around code of > >=== >def all=new NSMutableArray() >def nulls=... fetch with q-format ... "owner = NULL" >if (nulls) all.addObjectsFromArray(nulls) >def types=... fetch with q-format ... "owner.userType = %@",pc.userType >if (types) all.addObjectsFromArray(types) >return all >=== > >does? > >Thanks, >OC > > > _______________________________________________ >Do not post admin requests to the list. They will be ignored. >Webobjects-dev mailing list ([email protected]) >Help/Unsubscribe/Update your Subscription: >https://lists.apple.com/mailman/options/webobjects-dev/chill%40gevityinc.com > >This email sent to [email protected] _______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
