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 (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com