Hallo
some more undomanager problems.
I do have a new enterprise object "EO_A" that i insert in a newly
created EC and i call savechanges. So far so good.
"EO_A" is the owner part of a oneToMany relationship with "EO_B". So i
create a new "EO_B" with the appropriate relation that i save as well.
Now i decide to delete "EO_B" and commit again, which is still fine.
After that, i change my mind and call undo() on the undomanager to
unroll up to the point before
where EO_B was created but before it was inserted in the EC. So
obviously there won't be no EO_B in the database anymore. Now if i
call savechanges somewhere down the road,
i get an IllegalStateException.
here is my simple testcase
enterpriseObject_A = SFIncident.createSFIncident(new
EOEditingContext(), new NSTimestamp());
enterpriseObject_A.editingContext().saveChanges();
SFDocument enterpriseObject_B_With_RelationshipTo_A =
enterpriseObject_A.createSFDocumentsRelationship(); // A <- oneToMany -
> B
enterpriseObject_B_With_RelationshipTo_A.setCreated(new
NSTimestamp());
enterpriseObject_B_With_RelationshipTo_A.setCategory("aCategory");
enterpriseObject_A.editingContext().saveChanges();
Assert.assertEquals(1,enterpriseObject_A.sFDocuments().count());
enterpriseObject_B_With_RelationshipTo_A
.sFIncident
().deleteSFDocumentsRelationship
(enterpriseObject_B_With_RelationshipTo_A); // delete the relation B
enterpriseObject_A.editingContext().saveChanges();
Assert.assertEquals(0,enterpriseObject_A.sFDocuments().count());
enterpriseObject_A.editingContext().undoManager().undo();
enterpriseObject_A.editingContext().saveChanges();
The undomanager seems not to clear the snapshot of the
enterpriseObject_B_With_RelationshipTo_A in memory when he removes it
from the database as the following exception shows.
java.lang.IllegalStateException: rowDiffsForAttributes: snapshot in
com.webobjects.eoaccess.EODatabaseOperation {_dbSnapshot = {}; _entity
= "SFDocument"; _newRow = {typ =
<com.webobjects.foundation.NSKeyValueCoding$Null>; hasMedicalData =
false; downloadLink = <com.webobjects.foundation.NSKeyValueCoding
$Null>; externalCreationDate =
<com.webobjects.foundation.NSKeyValueCoding$Null>; info =
<com.webobjects.foundation.NSKeyValueCoding$Null>; path =
<com.webobjects.foundation.NSKeyValueCoding$Null>; created =
2010-06-24 08:32:52 Etc/GMT; data =
<com.webobjects.foundation.NSKeyValueCoding$Null>; name =
<com.webobjects.foundation.NSKeyValueCoding$Null>; documentID = 1;
category = "aCategory"; }; _object =
"<net.starhealthcare.sffoundation.model.SFDocument pk:"1">"; _globalID
= _EOIntegralKeyGlobalID[SFDocument (java.lang.Integer)1];
_databaseOperator = "EODatabaseUpdateOperator"; } does not contain
value for attribute named category with snapshot key: category
at
com
.webobjects
.eoaccess
.EODatabaseOperation.rowDiffsForAttributes(EODatabaseOperation.java:344)
at
com
.webobjects
.eoaccess
.EODatabaseContext
.createAdaptorOperationsForDatabaseOperationAttributes
(EODatabaseContext.java:5196)
at
com
.webobjects
.eoaccess
.EODatabaseContext
.createAdaptorOperationsForDatabaseOperation(EODatabaseContext.java:
5373)
at
com
.webobjects
.eoaccess.EODatabaseContext.performChanges(EODatabaseContext.java:6188)
at
com
.webobjects
.eocontrol
.EOObjectStoreCoordinator
.saveChangesInEditingContext(EOObjectStoreCoordinator.java:376)
at
com
.webobjects
.eocontrol.EOEditingContext.saveChanges(EOEditingContext.java:3192)
at
net
.starhealthcare
.sffoundation
.test
.SFPatientDocumentPageTest
.addingAndDeletingDocumentAndUndoingChangesAndSaving
(SFPatientDocumentPageTest.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun
.reflect
.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod
$1.runReflectiveCall(FrameworkMethod.java:44)
at
org
.junit
.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:
15)
at
org
.junit
.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:
41)
at
org
.junit
.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at
org
.junit
.runners
.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at
org
.junit
.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at
org
.junit
.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at
org
.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:
28)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at
org
.eclipse
.jdt
.internal
.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
at
org
.eclipse
.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org
.eclipse
.jdt
.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:
467)
at
org
.eclipse
.jdt
.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:
683)
at
org
.eclipse
.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:
390)
at
org
.eclipse
.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:
197) _______________________________________________
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:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com