Re: access to flattened relationship EOs
Re: access to flattened relationship EOs
- Subject: Re: access to flattened relationship EOs
- From: Chuck Hill <email@hidden>
- Date: Fri, 9 Nov 2007 10:00:56 -0800
On Nov 8, 2007, at 4:09 PM, Zak Burke wrote:
I have two EO classes joined in a flattened many-to-many
relationship (User <-->> UserGroupJoin <<--> Group). UserGroupJoin
is dead-simple -- nothing but foreign keys to User and Group.
I want to log whenever one of the join items is created or removed.
The UI for this is a UserEdit page with Group items in checkboxes,
and, likewise, a GroupEdit page with User items in checkboxes.
I use a custom EC subclass, so I thought I'd create the log by
checking for UserGroupJoin items in insertedObjects() and
deletedObjects() during saveChanges(). Well, they never show up
there. So then I tried adding logging to
UserGroupJoin.awakeFromInsertion(). That isn't called either.
Does anybody know how I can get at this information?
Do you actually have a Java class for UserGroupJoin? I usually leave
that as pure EOGenericRecord.
To answer your question, I would not bother looking at the join
table. Instead, I would look at the users() and groups()
relationship on the relevant object, or get the UI to call a method
(e.g. includeUserInGroup(), excludeUserFromGroup()) that both updates
the relationship and logs the change. Another solution is to use
something like the "will save" notifications from ERXEC, the
Cooperating Editing Context from PWO, or the NotifiyingEditingContext
() from the GVC frameworks.
Chuck
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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