X-Junk-Score: 0 [] X-KAS-Score: 0 [] Return-Path: Received: from mail-108-mta70.mxroute.com ([136.175.108.70] verified) by selbstdenker.ag (CommuniGate Pro SMTP 6.3.18) with ESMTPS id 35351075 for webobjects-dev@wocommunity.org; Thu, 26 Feb 2026 03:38:13 +0100 Received-SPF: pass receiver=post.selbstdenker.com; client-ip=136.175.108.70; envelope-from=aaron@chatnbike.com Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta70.mxroute.com (ZoneMTA) with ESMTPSA id 19c97cf6e460007228.001 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Thu, 26 Feb 2026 02:37:59 +0000 X-Zone-Loop: 584a2c0160fe1a5f591c7fa2759c350ef915040c90ad X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=chatnbike.com; s=x; h=To:References:Content-Transfer-Encoding:Cc:Date: In-Reply-To:From:Subject:Mime-Version:Content-Type:Sender:Reply-To:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID; bh=qf7e/LBOfM8j1yPskxWgFl07KX4pTRIRILCabgi14VA=; b=V2pw78rJETAUfuwhC2QSuFsKe2EOYN08ZWhOZRSlVBc5VX34YtpHXeghBkUTvIvz5Uwl1wpezK0 rvoqMJAtR/tMoHSeGiGmJ5EZtH7SVADMNN+AdBPN9lwEJx4YPnxUrK9/k+5d+BTkwwlXAB7RwdLiu 0gBEBVxBvqL0iQNsBVI9HXPTPH2CoZkmJUUTep4SOf/uGB05gVNie6AwsRVabsVtkd3UYYO1kHU2t C7vsFM2CjEIcdY8ldN4hKODg3eL0cNKOH2kqIGjEWH3LBy2UGse0kQn+k77ew/DgyVWIcMXQMT6eZ aW31e1003uHBUsTdDKn/LbYqTSnqw0FZDUMQ==; Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.10\)) Subject: Re: [WO-DEV] validateForSave() question From: Aaron Rosenzweig In-Reply-To: <2e913111-33ed-4dbb-9273-bdc6acafa932@yahoo.com> Date: Wed, 25 Feb 2026 21:37:54 -0500 Cc: WebObjects & WOnder Development Content-Transfer-Encoding: quoted-printable Message-Id: <0E521974-9FFE-4FD8-8E8C-D5C6446D9ABE@chatnbike.com> References: <53AD1CD3-B098-4115-8197-8BCADC0E311D@chatnbike.com> <2e913111-33ed-4dbb-9273-bdc6acafa932@yahoo.com> To: Theodore Petrosky X-Authenticated-Id: aaron@chatnbike.com You could have a unique index on the compound key of the many-to-many = table. That would prevent duplicates at the DB level. You could give a user friendly message with either validateForSave() > On Feb 25, 2026, at 7:57 PM, Theodore Petrosky = wrote: >=20 > yea, it is a many to many. I put both validateForInsert and ForSave = with logs to see them fire. I think I need to check for duplicates in = the validateForSave. >=20 > so here is the quandary there is an entity Event. an event has a show = and a show has an array of books. people are assigned to books. right = now Jon is assigned to book 1 of event.show.LionKing. >=20 > If I edit the books (EditRelationshipEmbeddedEventBook) I can assign = Jon to two books. This is what I am trying to eliminate. The possibility = of a human error (that means that Jon gets paid twice.) >=20 > Whoops >=20 > Ideas? >=20 > Ted >=20 >=20 > On 2/23/26 7:52 PM, Aaron Rosenzweig wrote: >> If it=E2=80=99s strictly a toMany relationship, I don=E2=80=99t see = how they could be added twice. >>=20 >> Is it a many-to-many? In that case, the same person could be added = twice. In that case, I=E2=80=99d put the validateForInsert() on the join = table. I=E2=80=99d try to find at least one other join table pointing to = the same person and entity. >>=20 >>> On Feb 23, 2026, at 5:50 PM, Theodore Petrosky = wrote: >>>=20 >>> I am trying to add a check in validateForSave. my entity has a = toMany relation with my Person entity. I need to check if a person has = been added twice. >>>=20 >>> So basically, if Jon has been added twice throw the validation = exception. so I guess, here is an array of persons, are they all unique? >>>=20 >>> Am I being clear? >>>=20 >>> public void validateForSave() throws = NSValidation.ValidationException { >>>=20 >>> Ted >>>=20 >>> BTW, I tried to send this to webobjects-dev@lists.apple.com, but it = looks like it has been down for a couple of days or longer. >>>=20 >>>=20 >>> ############################################################# >>> This message is sent to you because you are subscribed to >>> the mailing list . >>> To unsubscribe, E-mail to: >>> To switch to the DIGEST mode, E-mail to = >>> To switch to the INDEX mode, E-mail to = >>> Send administrative queries to = >>>=20