I have a problem that shows up intermittently.
I have entities with to many relationship as follows:
Account <->> Transaction
The relationship "account" in the entity Transaction is mandatory since a Transaction must always be associated with an account.
The problem that happens is that sometimes when I delete a Transaction, I get a validation exception regarding the mandatory relationship. Examining the EC before the save shows that the relationship has been nulled by the delete operation and shows that the object being deleted is in the list of UpdatedObjects. The times that it succeeds, the object is in the ec's list of DeletedObjects before saveChanges is called ?!!
Looking at the call stack for the times that the error does happen (remember, most of the time it just works as expected) I see that validateForUpdate is being called on this object ......
So, the question is why is validateForUpdate being called on an objected that I have deleted?
<er.extensions.ERXValidationException object: <CTAccountTransaction pk:"16596">; propertyKey: account; type: MandatoryToOneRelationshipException; additionalExceptions: ()> at com.webobjects.eoaccess.EORelationship.validateValue(EORelationship.java:1805) at com.webobjects.eoaccess.EOEntityClassDescription.validateValueForKey(EOEntityClassDescription.java:443) at er.extensions.ERXEntityClassDescription.validateValueForKey(ERXEntityClassDescription.java:726) at com.webobjects.eocontrol.EOCustomObject.validateValueForKey(EOCustomObject.java:1339) at er.extensions.ERXGenericRecord.validateValueForKey(ERXGenericRecord.java:776) at com.webobjects.eocontrol.EOCustomObject.validateForSave(EOCustomObject.java:1411) at er.extensions.ERXGenericRecord.validateForSave(ERXGenericRecord.java:823) at com.webobjects.eocontrol.EOCustomObject.validateForUpdate(EOCustomObject.java:1490) at er.extensions.ERXGenericRecord.validateForUpdate(ERXGenericRecord.java:862) at com.webobjects.eocontrol.EOEditingContext.validateTable(EOEditingContext.java:2252) at com.webobjects.eocontrol.EOEditingContext.validateChangesForSave(EOEditingContext.java:3042) at com.webobjects.eocontrol.EOEditingContext._prepareForPushChanges(EOEditingContext.java:3283) at com.webobjects.eocontrol.EOEditingContext.saveChanges(EOEditingContext.java:3213) at er.extensions.ERXEC.saveChanges(ERXEC.java:474) at WKEditingContext.saveChanges(WKEditingContext.java:46)
Regards,
-Kieran ________________________________________________________________ Blog: http://webobjects.webhop.org/ Dev Config = OS X 10.4.6 i686-C.Duo / Java 1.4.2_09 / WO 5.3.1 & P. Wonder / XCode v2.2.1 / MySQL 4.1.18-std / Connector-J 3.0.17 Deploy Config = OS X 10.3.9 Server G4-PPC / Java 1.4.2_09 / WO 5.2.3 / MySQL 4.0.26 / Connector-J 3.0.17
|