Re: Strange error message
Pierre Bernard <[email protected]>
| Newsgroups | gmane.comp.web.webobjects.eof |
|---|---|
| Message-ID | <[email protected]> |
Anjo, > Been thinking about this: the easiest thing I could come up with is a > databasecontext delegate that > > a) responds to databaseContextNewPrimaryKey(), then checks if the > entity in question is subclassed, then re-calc the root entity's max > key > b) responds to databaseContextWillFireObjectFaultForGlobalID(), then > checks if the entity in question is abstract, tries every subclassed > entity in question and raise if there are more than one candidate > objects. > > Would that work? Does is make sense? At least you get some control > over the situation without having to mess with your model... It's hard to tell off the bat. I would however expect that object uniquing gets in your way. That is if you want to fetch Car with ID 1 and Bicycle with ID 1 exists already in the editing context, both will have a Vehicle ID 1 global ID. Thus the object is thought to exist already and no fault will be fired. I guess the easiest solution to implement is to modify your EOModel at application launch time. You could have flagged all entities where children have IDs that are not unique with a special key in the userInfo dictionary. At runtime you remove these entities from the model, leaving only the child entities. You may want to first do a sanity check verifying that the parent entity is not referenced by any relationship. Thus errors introduced later on in the model would be detected promptly. Pierre --- Spinning WebObjects or cooking up Cocoa in Switzlerland? Let me know: http://homepage.mac.com/I_love_my/