Re: qualifier to check for empty toMany
Re: qualifier to check for empty toMany
- Subject: Re: qualifier to check for empty toMany
- From: Fred Wells <email@hidden>
- Date: Thu, 12 May 2011 12:33:40 -0500
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 clauseHere'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"));
EOQualifier qual8 = ERXQ.and(qA,qB,qC,qD,qE);
From:
Alexis Tual <email@hidden>To:
John Huss <email@hidden>Cc:
Fred Wells <email@hidden>,
email@hiddenDate:
05/11/2011 05:22 PMSubject:
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 helpsAlexLe 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@hidden>
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
------------------------------------------------------------------------
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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden