• 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: failed to find a snapshot for EO with Global ID
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: failed to find a snapshot for EO with Global ID


  • Subject: Re: failed to find a snapshot for EO with Global ID
  • From: Farrukh Ijaz <email@hidden>
  • Date: Tue, 12 Jun 2012 06:03:48 +0300

Hi Ramsey,

I think, the parent ec doesn't know anything what's in the child ec. So according to your code, the employee records belong to child ec. ec.saveChanges() after nested.saveChanges() inside the inner loop has no effect as there are no changes in parent ec to save at this point. Try nestC.delete() after nested.saveChanges(). I this works, then I guess you need to refetch the relationships for c before you call c.delete().

But I am confused why it's working for lesser items :)

Farrukh

Ramsey Gurley <email@hidden> wrote:

Hi all,

I have a suspicion that something is wrong with the way nested ECs are currently working. The errors I see are the result of missing snapshots.  The errors are very sporadic and hard to reproduce. I've managed to distill this down to a simple test case.  If I drop this:

    public void testNestedECs() {
    try {
    EOEditingContext ec = ERXEC.newEditingContext();
    for(int i = 0; i < 100; i++) {
    Company c = (Company) EOUtilities.createAndInsertInstance(ec, Company.ENTITY_NAME);
    c.setName(UUID.randomUUID().toString());
    ec.saveChanges();
    EOEditingContext nested = ERXEC.newEditingContext(ec);
    Company nestC = c.localInstanceIn(nested);
    for(int j = 0; j < 10; j++) {
    Employee e = (Employee) EOUtilities.createAndInsertInstance(nested, Employee.ENTITY_NAME);
    e.setFirstName(UUID.randomUUID().toString());
    e.setLastName(UUID.randomUUID().toString());
    e.setManager(Boolean.FALSE);
    e.addObjectToBothSidesOfRelationshipWithKey(nestC, Employee.COMPANY_KEY);
    nested.saveChanges();
    ec.saveChanges();
    }
    c.delete();
    ec.saveChanges(); //Line 78
    }
    } catch (Exception e) {
    e.printStackTrace();
    Assert.fail(e.getMessage());
    }
    }

into ERXECTest.java, I get fairly reliable failures due to missing snapshots.

java.lang.IllegalStateException: recordDeleteForObject: com.webobjects.eoaccess.EODatabaseContext com.webobjects.eoaccess.EODatabaseContext@489bb457 failed to find a snapshot for EO with Global ID:_EOIntegralKeyGlobalID[Employee (java.lang.Integer)491] that has been deleted from er.extensions.eof.ERXECer.extensions.eof.ERXEC@44581ea2. Cannot delete an object that has not been fetched from the database
at com.webobjects.eoaccess.EODatabaseContext.recordDeleteForObject(EODatabaseContext.java:4732)
at com.webobjects.eoaccess.EODatabaseContext.recordChangesInEditingContext(EODatabaseContext.java:5890)
at com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditingContext(EOObjectStoreCoordinator.java:373)
at com.webobjects.eocontrol.EOEditingContext.saveChanges(EOEditingContext.java:3192)
at er.extensions.eof.ERXEC._saveChanges(ERXEC.java:1177)
at er.extensions.eof.ERXEC.saveChanges(ERXEC.java:1100)
at er.extensions.eof.ERXECTest.testNestedECs(ERXECTest.java:78)

If I drop the number of loops down to 10 instead of 100, I don't see the exceptions.  Does anyone see an obvious problem with my test case or perhaps have ideas about what's going wrong before I begin digging? :-)

Ramsey


 _______________________________________________
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

  • Prev by Date: failed to find a snapshot for EO with Global ID
  • Next by Date: Re: failed to find a snapshot for EO with Global ID
  • Previous by thread: Re: failed to find a snapshot for EO with Global ID
  • Next by thread: Re: failed to find a snapshot for EO with Global ID
  • Index(es):
    • Date
    • Thread