Re: ERXEC vs EOEditingContext
Re: ERXEC vs EOEditingContext
- Subject: Re: ERXEC vs EOEditingContext
- From: Johnny Miller <email@hidden>
- Date: Fri, 13 Mar 2009 11:25:33 -1000
Sorry for the confusion.
Here is a quick snap shot of my "records"?.
User <->>Site<->>Document<->>Node*<->>Node**<->>Version
If I delete a "child" node (**) - the versions get deleted but when I
delete User in the tear down method I get the error.
If I delete the "parent" node (*) all is fine.
I'm using WO 5.4.3, Wonder Frameworks date from 12.29.2008
I was not locking but I still received the same error after adding it.
Thanks for your help,
Jon
On Mar 13, 2009, at 11:08 AM, Lachlan Deck wrote:
On 14/03/2009, at 7:26 AM, Johnny Miller wrote:
I was writing some tests to verify my eomodel and I came into a
situation where the test would fail if I used
ERXEC.newEOEditingContext() vs new EOEditingContext() for the
editing context.
Basically, I have many entities that are chained together by one to
many relationships. In the test I check if I delete one of the
lower entities that the the entities connected to it's to many
relationship are deleted by the cascade rule.
----------------------
Terminology helps :-) Entity as akin to Class or type. Record is
akin to instance. Therefore, you're either talking about 'records'
rather than entities or you're talking about inheritance (i.e., an
entity has a relationship to an abstract parent entity in
inheritance).
It's clearer to talk using records / instances rather than entities
because you create Entities via the modeler which are the abstract
definition of both your java classes and database schema.
So, I believe you mean:
Basically, I have many records (of type 'A') that have a toOne
relationship to records of type 'B'. Thus, A <<--> B. i.e., records
of type 'A' are grouped by the fact that each record 'B' has a
toMany relationship to a set of records of type 'A'.
In the test I check if I delete one of the record Bs that all the
'A' records connected to it's to many relationship are deleted by
the cascade rule.
Using ERXEC, however, during the tearDown I get the following error:
(Clearer? Or did you mean something else?)
Secondly, what version of WO/Wonder are you using?
----------------------
Anyway, are you locking? i.e.,
ec.lock();
try {
} finally {
ec.unlock();
}
java.lang.IllegalArgumentException: Array is empty
at com.webobjects.foundation.NSArray.objectAtIndex(NSArray.java:392)
at
com
.webobjects
.eocontrol
._EOCheapCopyMutableArray
.objectAtIndex(_EOCheapCopyMutableArray.java:110)
at
com
.webobjects
.eocontrol
.EOClassDescription
.propagateDeleteForObject(EOClassDescription.java:502)
at
com
.webobjects
.eocontrol
.EOCustomObject
.propagateDeleteWithEditingContext(EOCustomObject.java:693)
at
com
.webobjects
.eocontrol
.EOClassDescription
.propagateDeleteForObject(EOClassDescription.java:509)
at
com
.webobjects
.eocontrol
.EOCustomObject
.propagateDeleteWithEditingContext(EOCustomObject.java:693)
at
com
.webobjects
.eocontrol
.EOClassDescription
.propagateDeleteForObject(EOClassDescription.java:509)
at
com
.webobjects
.eocontrol
.EOCustomObject
.propagateDeleteWithEditingContext(EOCustomObject.java:693)
at
com
.webobjects
.eocontrol
.EOEditingContext.propagateDeletesUsingTable(EOEditingContext.java:
2248)
at
com
.webobjects
.eocontrol
.EOEditingContext._processDeletedObjects(EOEditingContext.java:2210)
at
com
.webobjects
.eocontrol
.EOEditingContext._processRecentChanges(EOEditingContext.java:1770)
at
com
.webobjects
.eocontrol
.EOEditingContext.processRecentChanges(EOEditingContext.java:1969)
at er.extensions.eof.ERXEC.processRecentChanges(ERXEC.java:659)
at er.extensions.eof.ERXEnterpriseObject
$Observer.editingContextWillSaveChanges(ERXEnterpriseObject.java:46)
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:585)
at
com
.webobjects.foundation.NSSelector._safeInvokeMethod(NSSelector.java:
122)
at com.webobjects.foundation.NSNotificationCenter
$_Entry.invokeMethod(NSNotificationCenter.java:588)
at
com
.webobjects
.foundation
.NSNotificationCenter.postNotification(NSNotificationCenter.java:532)
at
com
.webobjects
.foundation
.NSNotificationCenter.postNotification(NSNotificationCenter.java:546)
at er.extensions.eof.ERXEC.saveChanges(ERXEC.java:901)
at
com
.kahalawai
.unittests.enterprise.VersionTest.tearDown(VersionTest.java:144)
at junit.framework.TestCase.runBare(TestCase.java:140)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at
org
.junit
.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:76)
at
org
.eclipse
.jdt
.internal
.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
at
org
.eclipse
.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org
.eclipse
.jdt
.internal
.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at
org
.eclipse
.jdt
.internal
.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at
org
.eclipse
.jdt
.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:
386)
at
org
.eclipse
.jdt
.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:
196)
Is there something in my model that could have caused this?
Best,
Jon
_______________________________________________
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
with regards,
--
Lachlan Deck
_______________________________________________
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