首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 开源软件 >

hibernate投射继承关系

2012-08-16 
hibernate映射继承关系DOClass{id}ClassA extends DOClass{A1}ClassC extends ClassA{C1}ClassD extends C

hibernate映射继承关系

DOClass{      id   }   ClassA extends DOClass{       A1   }      ClassC extends ClassA{       C1   }      ClassD extends ClassA{       D1   }      ClassG extends ClassD{       G1   }      ClassH extends ClassD{       H1   }      ClassB extends DOClass{       B1   }      ClassE extends ClassB{       E1,e2,e3,e4,e5,e6   }      ClassF extends ClassB{       F1,f2,f3,f4,f5,f6,f7   }      TABLE_A {ID(PK),A_TYPE(discriminator),A1,C1,D1,G1,H1}   TABLE_B {ID(PK),B1}   TABLE_E {B_ID(PK/FK),E1,E2,E3,E4,E5,E6}   TABLE_F {B_ID(PK/FK),F1,F2,F3,F4,F5,F6,F7}      ClassA.hbm.xml   <hibernate-mapping>       <class name=”ClassA” table=”TABLE_A” discriminator-value=”A”>           <id/>           <discriminator column=”A_TYPE” type=”string”/>           <property name=”a1” column=”A1”/>           <sub-class name=”ClassC” discriminator-value=”C”>               <property name=”c1” column=”C1”/>           </sub-class>   <subclass name=”ClassD” discriminator-value=”D”>               <property name=”d1” column=”D1”/>               <subclass name=”ClassG” discriminator-value=”G”>                   <property name=”g1” column=”G1”/>               </subclass>               <subclass name=”ClassH” discriminator-value=”H”>                   <property name=”h1” column=”H1”/>               </subclasss>   </subclass>   </class>   </hibernate-mapping>   ClassB.hbm.xml   <hibernate-mapping>       <class name=”ClassB” table=”TABLE_B”>           <id/>           <property name=”b1” column=”B1”/>           <joined-subclass name=”ClassE” table=”TABLE_E”>               <key column=”B_ID”/>               <property name=”e1” column=”E1”/>               <property name=”e2” column=”E2”/>               <property name=”e3” column=”E3”/>               <property name=”e4” column=”E4”/>               <property name=”e5” column=”E5”/>               <property name=”e6” column=”E6”/>           </joined-subclass>           <joined-subclass name=”ClassF” table=”TABLE_F”>               <key column=”B_ID”/>               <property name=”f1” column=”F1”/>               <property name=”f2” column=”F2”/>               <property name=”f3” column=”F3”/>               <property name=”f4” column=”F4”/>               <property name=”f5” column=”F5”/>               <property name=”f6” column=”F6”/>               <property name=”f7” column=”F7”/>           </joined-subclass>       </class>   </hibernate-mapping>   

?

热点排行