Thanks John, I'll look into Houdah's -fw
From: John Huss <[email protected]> To: Fred Wells <[email protected]> Cc: [email protected] Date: 05/13/2011 12:13 PM Subject: Re: qualifier to check for empty toMany Yeah, that's true, me too. I actually have used the Houdah one more - it's called ExistsInRelationshipQualifier If you're not up for fixing Wonder's, you could try that one. John On Fri, May 13, 2011 at 12:08 PM, Chuck Hill <[email protected]> wrote: On May 12, 2011, at 11:49 AM, Alexis Tual wrote: Le 12 mai 2011 à 19:33, Fred Wells a écrit : Almost but the SQL that get generated isn't right, any one know a way around this error? EvaluateExpression failed: <com.webobjects.jdbcadaptor.MicrosoftPlugIn$MicrosoftExpression: "SELECT DISTINCT t0.actualEndDate, t0.actualStartDate, t0.approvalOutput, t0.childNbr, t0.description, t0.duration, t0.duration_days, t0.duration_hours, t0.endDate, t0.fkParentTaskId, t0.fk_approval_user_id, t0.fk_jobTemplate_id, t0.fk_job_id, t0.fk_phase_id, t0.fk_status_id, t0.fk_taskType_id, t0.fk_workgroup_id, t0.idForTemplate, t0.isActive, t0.name, t0.overdueNotified, t0.pkid, t0.startDate, t0.threshold, t0.thresholdNotified, t0.threshold_days, t0.threshold_hours, t0.xCoordinate, t0.yCoordinate FROM Task t0 WHERE (not ( EXISTS ( SELECT t1.pkid FROM Task t1, UserTask T1 WHERE T1.taskPkid is not NULL AND t1.pkid = T1.taskPkid AND t1.pkid = t0.pkid ) ) AND t0.fk_jobTemplate_id is NULL AND t0.isActive = ? AND t0.fk_workgroup_id = ? AND (t0.fk_status_id = ? OR t0.fk_status_id = ? OR t0.fk_status_id = ?))" withBindings: 1:"Y"(isActive), 2:4(fk_workgroup_id), 3:4(fk_status_id), 4:5(fk_status_id), 5:2(fk_status_id)>: Next exception:SQL State:S1000 -- error code: 1011 -- msg: The correlation name 'T1' is specified multiple times in a FROM clause Here's my list of qualifiers: EOQualifier qA = ERXQ.or(ERXQ.equals("status",Status.startedStatus(editingContext())),ERXQ.equals("status",Status.lateStatus(editingContext())),ERXQ.equals("status",Status.thresholdStatus(editingContext()))); EOQualifier qB = ERXQ.equals("workgroup", user.workgroup()); EOQualifier qC = ERXQ.equals("isActive", strY); EOQualifier qD = ERXQ.isNull("jobTemplate"); EOQualifier qE = ERXQ.not(new ERXExistsQualifier(ERXQ.isNotNull("userTasks.taskPkid"), "pkid")); Hmm I guess you have Task ->> UserTask ... try something like that instead : EOQualifier qE = new ERXExistsQualifier(ERXQ.isNotNull(UserTask.ID_KEY), "userTasks"); This qualifier should fetch all Tasks having some userTasks...the first argument in ERXExistsQualifier should be optional in this case, but it doesn't allow a null qualifier... You should test this first, then try it with your rather big qualifier. This single qualifier in a fspec "should" generate this SQL : SELECT ... FROM TASK t0 WHERE EXISTS (SELECT t1.ID FROM USER_TASK t1 WHERE t1.ID is not NULL AND t1.ID_TASK = t0.ID) However, I've done a quick test and it generates wrong SQL, something like : SELECT ... FROM TASK t0 WHERE EXISTS (SELECT t1.ID FROM USER_TASK t1 WHERE t1.ID is not NULL AND t1.ID = t0.ID) So, either i'm doing it wrong or there's a small bug in this qualifier (generates primary key column instead of foreign key), i've corrected it in my workspace. But i'm curious to hear from the others, is there someone else using this qualifier successfully ? It looks like a bug to me. I mix the Wonder and Houdah qualifiers, and I don't recall which one I have used for this in the past or where I used it. Chuck EOQualifier qual8 = ERXQ.and(qA,qB,qC,qD,qE); From: Alexis Tual <[email protected]> To: John Huss <[email protected]> Cc: Fred Wells <[email protected]>, [email protected] Date: 05/11/2011 05:22 PM Subject: Re: qualifier to check for empty toMany Hi, John is right, if you have A ->> B, this should work : EOQualifier qual = new ERXExistsQualifier( ERXQ.isNotNull(B.A_FK_KEY) , A.TO_BS_KEY); ERXFetchSpecification<A> spec = new ERXFetchSpecification<A>(A.ENTITY_NAME, qual, null); (not tested though) hope it helps Alex Le 12 mai 2011 à 00:00, John Huss a écrit : I think you can do this with ERXExistsQualifier and a Not qualifier. John On Wed, May 11, 2011 at 4:29 PM, Fred Wells <[email protected]> wrote: Hey all, Maybe I missed something but is there a way to construct a qualifier that check that a toMany relationship is empty? Simply putting in "toMany =%@, new NSArray(new Object[] {NSKeyValueCoding.NullValue}doesn't do it because it tries to check across the join table which results in no objects being found. -fw _______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/alexis.tual%40gmail.com This email sent to [email protected] ------------------------------------------------------------------------ Disclaimer The information in this email and any attachments may contain proprietary and confidential information that is intended for the addressee(s) only. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, retention or use of the contents of this information is prohibited. When addressed to our clients or vendors, any information contained in this e-mail or any attachments is subject to the terms and conditions in any governing contract. If you have received this e-mail in error, please immediately contact the sender and delete the e-mail. _______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net This email sent to [email protected] -- Chuck Hill Senior Consultant / VP Development Come to WOWODC this July for unparalleled WO learning opportunities and real peer to peer problem solving! Network, socialize, and enjoy a great cosmopolitan city. See you there! http://www.wocommunity.org/wowodc11/ _______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/johnthuss%40gmail.com This email sent to [email protected] ------------------------------------------------------------------------ Disclaimer The information in this email and any attachments may contain proprietary and confidential information that is intended for the addressee(s) only. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, retention or use of the contents of this information is prohibited. When addressed to our clients or vendors, any information contained in this e-mail or any attachments is subject to the terms and conditions in any governing contract. If you have received this e-mail in error, please immediately contact the sender and delete the e-mail.
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
