• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to uninsert an EO from EC?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to uninsert an EO from EC?


  • Subject: Re: How to uninsert an EO from EC?
  • From: Karl <email@hidden>
  • Date: Thu, 28 Oct 2004 09:12:51 -0400

The problem is really no different than handling a transaction at the relational database layer. Usually you do that through BEGIN, CHECKPOINT and COMMIT/ROLLBACK type processing. You usually don't have any way of removing just a single database manipulation without either rolling back your entire transaction or at least rolling back to the last checkpoint. I find it hard to think of a scenario where this transaction based approach is not the correct one.

We generally design large amounts of processing using EOs in the same way by using nested Editing Contexts. The overall parentEC represents the start of the transaction and only contains EOs that we are unlikely to want to revert() - unless we decide to abort the whole thing. When adding or processing related objects, this takes place in a nestedEC which is either reverted or saved to the parent.

This seems to work well and eliminates the need for anything more complex such as nullifying references, etc.

Karl

On Oct 28, 2004, at 8:28 AM, Jean-François Veillette wrote:

Like Chuck, we design to not place the ec in such situation.
But I was told that a simple ec.deleteObject(obj) should work.
I vagely remember having to do it once, but wasn't successful, can't remember why. So I corrected the design to simply do a ec.revert().
If you try it, and you have any trouble, let us know,


- jfv

Le 04-10-28, à 01:16, Marek Wawrzyczny a écrit :

Thanks Chuck,

You answer kind of scares me... I was hoping for something more positive.

Unfortunately we cannot revert the editing context, too many objects get created and related during the life of the session. The relations are also getting more complex as the site matures and their creation depends on the state of too many other entities, we do frequent trips to the database to ensure data integrity.

I know many people create temporary structures to hold this type of information and then create the objects upon the final commit, but I cannot see a way to do this easily here.

Surely we cannot be the only one's in no-mans-land?

Marek


On 28/10/2004, at 12:52, Chuck Hill wrote:

If nothing else needs to be retained, a call to revert() should do the
trick. Otherwise you are probably deep in "undefined" territory. I don't
recall having ever seen this documented. I try to design my apps so that I
can just discard the ec to handle things like this.


Chuck


At 12:25 PM 28/10/2004 +1000, Marek Wawrzyczny wrote:
Hi,

How does one correctly remove/forget/discard/kill/obliterate a new,
uncommitted EO from an editing context? The EOEditingContext methods
seem to be designed for EOs that have already been committed to the
database.

I have never been able to find the correct way to do this without
resorting to a combination of calls to EC forgetObject(...) and
deleteObject(...), removal of any references through relationships,
etc... and every now and then end up creating the EO with nulled
relationships anyway in the database when saving the ec.

It all seems like a bit of black magic to me.


Marek Wawrzyczny

software engineer
-------------------------->
ish group pty ltd
http://www.ish.com.au
7 Darghan St Glebe 2037 Australia
phone +61 2 9660 1400   fax +61 2 9660 7400

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden


This email sent to email@hidden


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
com


This email sent to email@hidden
_______________________________________________
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


References: 
 >Re: How to uninsert an EO from EC? (From: Chuck Hill <email@hidden>)
 >Re: How to uninsert an EO from EC? (From: Marek Wawrzyczny <email@hidden>)
 >Re: How to uninsert an EO from EC? (From: Jean-François Veillette <email@hidden>)

  • Prev by Date: Re: How to uninsert an EO from EC?
  • Next by Date: RE: How to uninsert an EO from EC?
  • Previous by thread: Re: How to uninsert an EO from EC?
  • Next by thread: Re: How to uninsert an EO from EC?
  • Index(es):
    • Date
    • Thread