Inheritance strategy

There are three kinds of basic strategies for inheritence mapping:
1. table per hierarchy.
2. table per subclass.
3. table per concreteclass.

Table structure maybe the root reason to determine which kind strategy will be used.

Table per hierarchy:
With subclass element.
A discriminator column will be used to distinguish subclass.
Limitation: no not null constraint on sub class's property.
Fault: redandance data will be generated.

Table per subclass:
With joined-class elment.
There are tables for super class and each subclass, for every subclass, key elemnt is used to referenced to super class's primary key, and all common properties will be stored in super table. The relation between super table and sub table is one-to-one.
Fault: complex table structure.


Table per concrete class:
With union-class elemnt.
Super class responsible for genrate id and all common properties wich will stored in sub table.
Fault: redandance data will be generated.
Limitation: all common column should used the same column name for the properties are defined in super class.

posted on 2007-06-01 10:55 Sheldon Sun 阅读(246) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航:
 
<2007年6月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

导航

统计

常用链接

留言簿(3)

随笔档案

文章档案

搜索

最新评论

阅读排行榜

评论排行榜