• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problem deleting an object with a flattened relationship
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem deleting an object with a flattened relationship


  • Subject: Re: Problem deleting an object with a flattened relationship
  • From: Chuck Hill <email@hidden>
  • Date: Thu, 13 Mar 2008 11:16:46 -0700


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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

--

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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Problem deleting an object with a flattened relationship (From: Greg Lappen <email@hidden>)

  • Prev by Date: Problem deleting an object with a flattened relationship
  • Next by Date: Re: String Qualifier for Number
  • Previous by thread: Problem deleting an object with a flattened relationship
  • Next by thread: WWDC 08
  • Index(es):
    • Date
    • Thread