Mailing List webobjects-dev@wocommunity.org Message #280
From: Markus Ruggiero (rucotec) <webobjects-dev@wocommunity.org>
Subject: localinstance for not-yet-saved EOs?
Date: Fri, 15 Oct 2021 14:48:56 +0200
To: Jesse Tayler <webobjects-dev@wocommunity.org>
Signed Data (Text SHA256)
LocalInstance is only allowed for EOs that have already been saved. If isNewObject() return true then any form of localinstance call returns an exception. Why? And how can I overcome this?

I have the following scenario:

The user picks existing EOs to be worked on at a later point in time. They can also create on-the-fly new EOs for picking. All EOs as well as the new ones are associated with the current editing context. The whole list of picked objects (NSArray containing existing and new EOs) is then passed to the next page and on to the next. In each step some of the EOs are modified in various ways until about 3 steps down the line a final saveChanges() is done. All fine so far.

But on each step the user can go back up one step (either browser back button or with a dedicated navigation button on the page). The page cache takes care of this but the EOs themselves are not in the page cache and remain modified in their EC. Coming back the previous / first page does not show the initial state anymore. Ok, easy to solve (methinks): map the EOs into a new editing context right before going to the next step. Coming back then automatically throws away that EC. Going forward again will create a brand new EC. But! localInstancing into the new EC only works for saved EOs. How do I get these new EOs into the nextPhaseEC? The new EOs are fairly complex and already have relationships to other EOs. How can I re-wire the new EOs?

Thanks for any help
---markus---

Content Unaltered as verified By:
<markus.ruggiero@rucotec.ch>
Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to Listmaster