On Mar 13, 2008, at 11:14 AM, Greg Lappen wrote:

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:

java.lang.IllegalStateException: A valid global ID could not be obtained for entity named UnknownStatusPolicyReportItem, relationship named policies, primary key dictionary {policyID = 169; reportID = 15; }.

File
Line#
Method
Package
EODatabaseContext.java
4867
databaseOperationForIntermediateRowFromSourceObject
com.webobjects.eoaccess
EODatabaseContext.java
4891
recordDeleteForIntermediateRowFromSourceObjectRelationshipDestinationObject
com.webobjects.eoaccess
EODatabaseContext.java
4944
nullifyAttributesInRelationshipSourceObjectDestinationObject
com.webobjects.eoaccess
EODatabaseContext.java
4970
nullifyAttributesInRelationshipSourceObjectDestinationObjects
com.webobjects.eoaccess
EODatabaseContext.java
5882
recordChangesInEditingContext
com.webobjects.eoaccess
EOObjectStoreCoordinator.java
373
saveChangesInEditingContext
com.webobjects.eocontrol
EOEditingContext.java
3176
saveChanges
com.webobjects.eocontrol
ReportChooser.java
26
deleteReport

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);

Is s.user().editingContext() == entity.editingContext()?


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 protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net

This email sent to [EMAIL PROTECTED]

--

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects





_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to