Problem deleting an object with a flattened relationship
Problem deleting an object with a flattened relationship
- Subject: Problem deleting an object with a flattened relationship
- From: Greg Lappen <email@hidden>
- Date: Thu, 13 Mar 2008 14:14:26 -0400
Hello-
I am having a strange problem with our application on WebObjects 5.4 (not sure if it was present on 5.3, just giving some background).
The error occurs when I attempt to delete an object which has a flattened relationship. The error I get is:
The model classes involved are Policy, UnknownStatusPolicyReport, and UnknownStatusPolicyReportItem. UnknownStatusPolicyReport is a subclass (using single-table inheritance) of Report. A UnknownStatusPolicyReport has a to-many relationship to UnknownStatusPolicyReportItem, and UnknownStatusPolicyReportItem has a to-one relationship to Policy (each item in the report points to an insurance policy). I defined a flattened to-many relationship on UnknownStatusPolicyReport called policies which is defined as "items.policy". I also set the delete rule on the UnknownStatusPolicyReport items relationship to Cascade so the UnknownStatusPolicyReportItems get deleted when the UnknownStatusPolicyReport is deleted. The code that does the delete:
public WOComponent deleteReport() { Session s = (Session) session(); s.user().removeFromReports((Report)entity); session().defaultEditingContext().deleteObject((EOEnterpriseObject) entity); session().defaultEditingContext().saveChanges(); return null; }
Any assistance would be greatly appreciated....I am sure I'm missing something fundamental here about how EOF works.
Thanks,
Greg |
_______________________________________________
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