qualifier with (NULL or joined value)?
qualifier with (NULL or joined value)?
- Subject: qualifier with (NULL or joined value)?
- From: OC <email@hidden>
- Date: Tue, 26 Apr 2016 18:45:39 +0200
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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden