|
Signed Data (Text SHA256) |
Hi Samuel,
that’s an interesting approach. Thanks for the tip, will look into this.
---markus---
> On 17 Oct 2021, at 17:47, Samuel Pelletier <webobjects-dev@wocommunity.org> wrote:
>
> Hi Markus,
>
> Passing an EO to another EditingContext requires that this EO exists in the parent object store of the new ec knows about this EOGlobalID to retrieve the data snapshot.
>
> If an object is committed to the database, the root ObjectStore can retrieve it's data from the DB so it always works.
>
> In your case, I see 2 solutions, both require that the ec used in the picking phase know about the main ec use to edit the main object. If you pass the main object (even if not saved yet, you can get it's ec.
>
> 1- You use the main edited object's EOEditingContext in the picker but you loose the isolation if the changes...
>
> 2- You use the main edited object ec as the parent object store of the picking EOEditingContext like this:
>
> EOEditingContext ec = ERXEC.newEditingContext(); // Main ec
> EOEditingContext subEc = ERXEC.newEditingContext(ec); // In the picking sub component
>
> With solution 2, saving into subEc will commit the changes to the main ec (nothing sent to the database yet). You can then localInstance objects from the sebEc into the main ec.
>
> You can cascade this as deep or wide as required.
>
> Hope this can help you,
>
> Samuel
>
>
>> Le 15 oct. 2021 à 08:48, Markus Ruggiero (rucotec) <webobjects-dev@wocommunity.org> a écrit :
>>
>> 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---
>>
>
>
> #############################################################
> This message is sent to you because you are subscribed to
> the mailing list <webobjects-dev@wocommunity.org>.
> To unsubscribe, E-mail to: <webobjects-dev-off@wocommunity.org>
> To switch to the DIGEST mode, E-mail to <webobjects-dev-digest@wocommunity.org>
> To switch to the INDEX mode, E-mail to <webobjects-dev-index@wocommunity.org>
> Send administrative queries to <webobjects-dev-request@wocommunity.org>
>
|
Content Unaltered as verified By: |
<markus.ruggiero@rucotec.ch> |
|
|