[ojb-users] Mapping Inheritance hierarchy
Brought to you by:
thma
From: Govindarajan S (Gover) <gov...@az...> - 2002-06-03 13:29:41
|
Hi, I have a doubt regarding the mapping of an inheritance hierarchy. The first approach of mapping the entire inheritance hierarchy seems to be fine. Also i understand that OBJ supports 'Concrete Table inheritance mapping' ie mapping all concrete tables. My question is whether i can implement the 'Class table inheritance mapping' ie mapping all classes (including abstract classes)to individual tables. If yes how? One doubt i had is how to link a derived class 'D' with its parent class 'A'. Assume FootBall player class is inherited from Player and that player has an unique playerId. Now when u map the FootBall player to its corresponding table how will you write/read values from the Player table ? One of the white-papers suggested using foreignkey reference to the parent table. I understand that to implement this i would need to do a 1-1 mapping between the derived classes and the base class. But the way OBJ does 1-1 mapping u need to have a reference to the Base class in the derived class instance or vice-versa. This is where it hurts me, becoz what is the point in referring to the base class explicitly in a derived class? or iam missing some very obivious point here? I dont think i can use an external table for doing a 1-1 mapping between the Player table and Football player? gover |