"a table can't link to itself" 
mumuri
/ Jan 18, 2009 / 08:02 ![]()
hi
"a table can't link to itself" why ?
i mean if we wan't to link an "object category" to itself, it's not possible (for a directory for instance)
Options
Rating
Replies
-
Axel / Jan 20, 2009 / 09:40


If you mean inheritance on Model level, then the answer is probably no, as this is not part of Persistence, but of Behavior sub editor
mumuri / Jan 31, 2009 / 03:47

sorry i didn't understand you answer
i will give an example
MobileObject
-----------------------
motor
WheelsNumber
^
|
|
Car
-----------------------
Steering
Moto
-----------------------
exhaust
Moto extends MobileObject
Car extends MobileObject
MobileObject is abstrakt
In your opinion, what will be the db schema for this Model ? a one table for each sub object (car moto etc ...) , even if some class extending the first one (car moto etc ...) can have the same mobileObject properties?
edited by: mumuri, Jan 31, 2009 - 05:53 PM
Axel / Feb 01, 2009 / 12:05


As always there are different approaches available:
1) You could only Model MobileObject with something like a mobileType field. Depending on that field all additional properties of the concrete classes could be implemented / stored with attributes.
2) Create all three tables in the persistence layer and connect them with one-to-one relations, something like "MobileObject ---- extends ---> Car". Then every Car or Moto instance has also the MobileObject properties available implicitely.
Both are not real inheritance though. This is related to what I mentioned above: inheritance is no part of the whole persistence layer (at the moment). Either it will be added later (as a new relation type) or it will become part of the behavior layer (which corresponds to the green container elements in the main editor).
I suggest to try out point 2) as it should basically do what you want. But keep in mind that this is not the same as if the object classes would extend from each other.
mumuri / Feb 01, 2009 / 04:21

2) was what i was going to do , but the problem, is that if you do like this you create two form one for MobileObject and one for Car (without the specific part)
thanks anyway!
How to set up relations
- 8 Replies
- Axel on May 15, 2012 - 06:04
Neue Umfragen
You have not voted in the poll:
What should be improved in future?
