Re: Strange error message

Pierre Bernard <[email protected]>
Newsgroups gmane.comp.web.webobjects.eof
Message-ID <[email protected]>
Anjo,

>thanks for the exhaustive note. I'm still not sure why this wouldn't 
>affect to-many relationships or how to work around this in a more 
>general fashion.

to-many relationships could be affected the same way. I used the to-one relationship mainly as an example.

>I'm not sure what you mean: if I don't model the inheritance, would I 
>include Vehicle in my model? If I don't, then how could I have a 
>relationship to it? You don't happen to have a working example handy ?-)

That's the advantage of not having the Vehicle entity in the EOModel. You should not have relationships pointing to it. Having it outside the model eliminates all risks to create such a relationship later on in the project's lifetime. You may not call a fetch specification on the root entity if primary keys are not unique on the children.

I do have examples where the root enity is not declared in the EOModel. However I don't see how I could strip them down to a point to become helpful examples. Moreover I am using this type of inheritance for other reasons. I had situations where there was a logical inheritance but one table had an simple primary key whereas the other one had a composite one. I also had situations where entities were logically related but querying on both at the same time made no sense. E.g. an entity of which an archived copy exists.

There is nothing magic about having inheritance outside the EOModel. You simply need to manually create the root class as subclass of EOGenericRecord. In that root class you define methods common to all subclasses as abstract method. Your subclasses only need to inherit from that class rather than from EOGenericRecord. With appropriate templates and Makefile entries you can easily set this up with EOGenerator.

Pierre.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.