The source code in er.extensions.ERXGenericRecord.isDeletedEO() in Project Wonder looks like this ....

    /**
     * Determines if this object is a deleted object by
     * checking to see if it is included in the deletedObjects
     * array of the editing context or if it's editing context
     * is null.<br/>
     * <br/>
     * Note: An object that has just been created will also not
     * have an editing context and by this method would test
     * positive for being a deleted object.
     * @return if the object is a deleted object
     */
    // CHECKME: Might be able to tell better by checking EOGlobalIDs
    public boolean isDeletedEO() {
        if (log.isDebugEnabled())
log.debug("editingContext() = " + editingContext() + " this object: " + this); return editingContext() != null && editingContext().deletedObjects().containsObject(this);
    }

HTH,

Kieran

On Feb 18, 2006, at 4:26 PM, Miguel Arroz wrote:

Hi!

Imagine the following code (I'm writing this directly on the email, it's possible that it contains errors):


  EOEditingContext myContext = getMyContexy();
MyClass myObject = giveMeSomeObjectOfMyClassSotredOnTheDataStorage(myContext);
  myContext.deleteObject(myObject);
  myContext.saveChanges();


Right after this, what exactly is myObject? Is there a way to know that it references a previously deleted object? The only way I can find is calling myObject.editingContext() and catch a NullPointerException, but that method is very very dirty... is there a better way?

  Yours

Miguel Arroz

"We have no sympathy for the lost souls
We've chosen the path of disgrace
We give this life to our children
And teach them to hate this place" -- Apocalyptica, Life Burns!

Miguel Arroz
http://www.ipragma.com


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/ kieran_lists%40mac.com

This email sent to [EMAIL PROTECTED]


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to