码迷,mamicode.com
首页 > Web开发 > 详细

hibernate 集成映射

时间:2016-01-12 06:32:58      阅读:136      评论:0      收藏:0      [点我收藏+]

标签:

3中

1.subclass

    <class name="Worker" table="worker" discriminator-value="worker">

        <id name="id" type="java.lang.Integer">
            <column name="ID"/>
            <generator class="native"/>
        </id>

        <discriminator column="type" type="string"></discriminator>

        <property name="name"></property>

        <subclass name="Driver" discriminator-value="driver">
            <property name="car"></property>
        </subclass>
    </class>

2.joined-subclass

    <class name="Animal" table="animal">

        <id name="id" type="java.lang.Integer">
            <column name="ID"/>
            <generator class="native"/>
        </id>

        <property name="name"></property>

        <joined-subclass name="Cat" table="cat">
            <key column="cat_id"></key>
            <property name="food"></property>
        </joined-subclass>
    </class>

3.union-subclass

    <class name="Book" table="book">

        <id name="id" type="java.lang.Integer">
            <column name="ID"/>
            <generator class="assigned"/>
        </id>

        <property name="name"></property>

        <union-subclass name="English" table="english">
            <property name="language"></property>
        </union-subclass>

    </class>

 

hibernate 集成映射

标签:

原文地址:http://www.cnblogs.com/fengyexjtu/p/5123083.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!