I need to suggest three variants of the structure of the database that reflects object model of classes. The structure of the database should allow understand class inheritance. For simplicity, classes contains only attributes (no methods).
I consider Single Table Inheritance, Class Table Inheritance, Concrete Table Inheritance patterns.
But not everything is clear for me. The question are:
1) Where are classes stored in database, and where are instances of classes stored?
2) Let's say, class B
extends class A
. How to make instance b
of the B
understand that it is a derived A
? How to make b
understand that this is an instance of class B
, not class A
?
3) Is there a patter in which an addition of a new class to inheritance hierarchy does not require changing the structure of tables?
4) Is there a pattern which allows multiple inheritance?
UPD: Probably I expressed my thoughts not clear enough. Let's say it is not java, but any another language. This quiesion is in context of database structure. Is there pattern (like above) which allows multiple inheritance?
Thanks.