Change subclass at runtime ?
Dominique Schoenenberger <[email protected]> Sun, 20 Jun 2004 18:42:19 +0200
| Newsgroups | gmane.comp.web.webobjects.eof |
|---|---|
| Message-ID | <[email protected]> |
I have inheritance in my application and sometimes I have to change the subclass of a record. How to do that ? It is vertical inheritance so in theory, you have to change the class discriminating attribute in the database but if you do this at run time, the class may be already instanciated... do I have to refault the object ? and what about relationship ? One of my solution to this problem is to create a new object of the class we want to change to, copy all values of the properties of the old object to the new one and then delete the old object. This is a solution but it is much more complicated than changing the discriminating attribute... Anybody having already found something for this ? Dominique