Re: To-many relationship delete problem
Re: To-many relationship delete problem
- Subject: Re: To-many relationship delete problem
- From: Chuck Hill <email@hidden>
- Date: Wed, 18 Nov 2009 19:06:42 -0800
On Nov 18, 2009, at 6:53 PM, Kieran Kelleher wrote:
Hi Lon,
You might be better off not having an ERXEC subclass if you can
avoid it (even if Chuck uses one ;-) )
Chuck does not use ERXEC at all...
:-)
, because, IIRC, doing so requires you to have your own ERXEC
Factory, which by itself seems fine at first glance, but that then
prevents you using the ERXObjectStoreCoordinatorPool (because it
wants to use its own ERXEC factory), which in turn prevents you from
using OSC synchronization feature of Wonder. I painted myself into
this corner a couple of years ago and had to refactor a lot of code
to get rid of my EC subclass later.
In my case, I set the property WODefaultUndoStackLimit=0 which
basically disables UndoManager in Wonder, so not sure why that's
giving you trouble because I use that setting in all my apps. If you
really want to use UndoManager, and take advantage of Chuck's logic
shown below, then one of these three needs to happen....
1) Implement that logic in Wonder's ERXEC itself
2) Change Wonder to allow a custom ERXEC subclass to be specified
as an app property
3) Add a EditingContextDidSaveNotification that can be used to
clear undo stack after a save
#3 is probably the least effort and least impact to existing
logic .... so, rather than make a subclass of your own, you might be
better off adding that notification to ERXEC and submit a jira with
the patch and just use that notification to clear the undoManager.
Just FYI, hope the info is of use to you Lon,
Regards, Kieran
On Nov 18, 2009, at 5:16 PM, Lon Varscsak wrote:
Of course it does. :P Too bad I didn't know that before I hastily
changed the value.
I don't have a custom EC class...I just use ERXEC. However, that's
a good idea (as always).
Thanks,
-Lon
On Wed, Nov 18, 2009 at 3:00 PM, Chuck Hill <chill@global-
village.net> wrote:
IIRC, the undo stack has a hand in processing deletions. You can
only have this at zero if you never delete anything. I do this in
my EC instead:
/**
* Overridden to clear undo stack after a successful save.
*/
public void saveChanges()
{
super.saveChanges();
if (undoManager() != null)
{
undoManager().removeAllActions();
}
}
Chuck
On Nov 18, 2009, at 12:52 PM, Lon Varscsak wrote:
Holy crap, I found my problem...but I don't understand why. I was
setting WODefaultUndoStackLimit=0 (trying to turn off undos) and
apparently something in EOF and/or Wonder isn't happy with that.
-Lon
On Wed, Nov 18, 2009 at 1:18 PM, Lon Varscsak <email@hidden
> wrote:
I'm having a problem where I'm removing an object from a to-many
relationship (that owns destination) and the objects are remaining
in the editing context after processRecentChanges() is called (or
saveChanges())...which then results in an exception being thrown
because I have objects that are orphaned and don't have a required
relationship set (since it was cleared in the "remove" operation).
I swear this is something new...because I tested this a few weeks
ago, and I fear it's caused by updating my version of Wonder....but
I can't figure out why or where it's all going wrong.
Disclosures:
* I am deleting an object that was also inserted into the same
editing context...both not in the database (so temporary gids)
* The editing context in question is a child editing context for
another, but I don't think that's the issue, because I can get it
to happen without this setup.
* Using Wonder from 11/16/2009 (previous version unknown...sometime
in Oct probably)
* WO 5.4.3
* I'm using Wonder with updateInverseRelationships=true (although I
can get it to fail with =false) ...and the relationship on both
sides is correct, it's just that it didn't remove the object from
the insertedObjects array
Thanks,
Lon
_______________________________________________
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
--
Chuck Hill Senior Consultant / VP Development
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
--
Chuck Hill Senior Consultant / VP Development
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