Re: access to flattened relationship EOs
Re: access to flattened relationship EOs
- Subject: Re: access to flattened relationship EOs
- From: Zak Burke <email@hidden>
- Date: Fri, 09 Nov 2007 15:51:43 -0500
Chuck Hill wrote on 11/9/07 1:00 PM:
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.
That's normally what I do, too. In this case, I'm working with a legacy
model that defines a Java class for UserGroupJoin.
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,
This is what I wound up doing. The initial values are cached and then
compared with the updated values before EC.saveChanges(). Notifications
would be a nice way to handle it, but I'm not ready to tackle them yet.
Thanks,
zak.
_______________________________________________
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