Hibernate joined-subclass和subclass的配置文件

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
    Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
    <class name="com.rongbin.joinclass.Item" table="Item" schema="dbo" >
        <id name="id" type="java.lang.String">
            <column name="id" length="50" />
            <generator class="assigned" />
        </id>
       
        <property name="name" type="java.lang.String">
            <column name="name" length="50" not-null="true" ></column>
        </property>
        <property name="manufacturer" type="java.lang.String">
            <column name="manufacturer" length="50" not-null="true" />
        </property>
        <joined-subclass name="com.rongbin.joinclass.Book" table="Book">
         <key column="id"></key>
         <property name="pagecount" type="java.lang.String" column="pagecount"></property>
        </joined-subclass>
        <joined-subclass name="com.rongbin.joinclass.Dvd" table="Dvd">
         <key column="id"></key>
         <property name="regioncode" type="java.lang.String" column="regioncode"></property>
        </joined-subclass>
    </class>
</hibernate-mapping>

 

 

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
    Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
    <class name="com.rongbin.subclass.Item" table="TItem" schema="dbo" >
        <id name="id" type="java.lang.String">
            <column name="id" length="50" />
            <generator class="assigned" />
        </id>
        <discriminator column="category" type="java.lang.String"></discriminator>
        <property name="name" type="java.lang.String">
            <column name="name" length="50" not-null="true" />
        </property>
        <property name="manufacturer" type="java.lang.String">
            <column name="manufacturer" length="50" not-null="true" />
        </property>     
        <subclass name="com.rongbin.subclass.Book" discriminator-value="1">
         <property name="pagecount" type="java.lang.String">
            <column name="pagecount" length="50" />
        </property>
        </subclass>    
        <subclass name="com.rongbin.subclass.Dvd" discriminator-value="2">
          <property name="regioncode" type="java.lang.String">
            <column name="regioncode" length="50" />
        </property>
        </subclass>
    </class>
</hibernate-mapping> 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值