In my project I have an object
Player (attr example:
pl_data1) that is one of these types:
In mapping this objects to database :
Make a Table
Player with columns (
In this option we have one record for any player. So if an player is a goalkeeper, the column
gk_data1 will be filled and other column (
fw_data1) will be null.
Option 2: make
Playerwith columns: (
GoalKeeperwith columns: (
Defenderwith columns: (
Forwardwith columns: (
pl_id in child tables (
Forward) links to
Player.pl_id. relation from child tables to parent is one to one and from parent to childs is one to one_or_zero.
- which is better?
- is there any other (and better) options?
- and finally what is best practice in this situation?