<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 325,  comments - 25,  trackbacks - 0
    為了持久化類之間的繼承關系映射到數據庫中,可以采用為每個具體的子類對應一個關系表,沒有父類數據表
    數據表:
    customer:
    id int(4) <pk>
    name varchar(20)
    phone varchar(20)

    oneoffOrders:一次性付款訂單表
    id int(4)  <pk>
    customer_id int(4)
    orderno varchar(20)
    moeny decimal(10,2)
    rebate decimal(10,2) 折扣金額

    dividedOrders:分期付款訂單表
    id int(4) <pk>
    customer_id int(4)
    moeny decimal(10,2)
    rebate decimal(10,2)
    months int(4)

    持久化類:
    public class Customer implements Serializable{
        private Integer id;
        private String name;
        private String phone;
        private Set orders=new HashSet();
        pulic Customer(){
        }
    }
    //父類
    public abstrace class Orders{
        private Integer id;
        private String orderno;
        private Double moeny;
        private Customer customer;
        public Orders(){
        }
    }
    //子類 Oneofforders
    public class Oneofforders extends Orders implements Serializable{
        private Double rebate;
        public Oneofforders(){
        }
    }
    //子類 Dividedorders
    public class Dividedorders extends Orders implements Serializable}
        private Integer months;
        public Dividedorders(){
        }
    }
    hbm.xml
    <hibernate-mapping package="com.lhb.vo">
        <class name="Customer" table="customer">
            <id name="id" column="id" type="integer">
                <generator class="native"/>
            </id>
            <property name="name" column="name" type="string"/>
            <property name="phone" column="phone" type="string"/>
            <set name="orders" lazy="false"  cascade="all" inverse="true">
                <key column="customer_id"/>
                <one-to-many class="com.lhb.vo.Orders"/>
            </set>
        </class>
    </hibernate-mapping>
    <hibernate-mapping package="com.lhb.vo">
        <class name="Oneofforders" table="oneofforders">
            <id name="id" column="id" type="integer">
                  <generator class="native"/>
            </id>
            <property name="orderno" column="orderno" type="string"/>
            <property name="ordername" column="ordername" type="string"/>
            <property name="rebate" column="rebate" type="double"/>
            <many-to-one name="customer" column="customer_id" class="com.lhb.vo.Customer" lazy="false" not-null="true"/>
        </class>
    </hibernate-mapping>
    <hibernate-mapping package="com.lhb.vo">
        <class name="Dividedorders" table="dividedorders">
            <id name="id" column="id" type="integer">
                <generator class="native"/>
            </id>
            <property name="orderno" column="orderno" type="string"/>
            <property name="money" column="money" type="double"/>
            <proerty name="months" column="months" type="double"/>
            <many-to-one name="customer" column="customer_id" class="com.lhb.vo.Customer" lazy="false" not-null="true"/>
        </class>
    </hibernate-mapping>
    posted on 2008-05-25 21:32 長春語林科技 閱讀(308) 評論(0)  編輯  收藏 所屬分類: hibernate
    <2008年5月>
    27282930123
    45678910
    11121314151617
    18192021222324
    25262728293031
    1234567

     

    長春語林科技歡迎您!

    常用鏈接

    留言簿(6)

    隨筆分類

    隨筆檔案

    文章分類

    文章檔案

    相冊

    收藏夾

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 人碰人碰人成人免费视频| 四虎影视永久免费观看网址| 免费又黄又爽的视频| 亚洲欧好州第一的日产suv| 国产成人免费网站| 亚洲三级中文字幕| 日本一区二区三区免费高清| 亚洲一级片在线观看| 免费无码AV片在线观看软件| 亚洲中文字幕无码爆乳| 白白国产永久免费视频| 另类图片亚洲校园小说区| 亚洲精品WWW久久久久久| a毛片成人免费全部播放| 国产亚洲精品成人AA片新蒲金 | 亚洲av无码成人影院一区| 国产网站在线免费观看| 色费女人18女人毛片免费视频| 亚洲人成影院在线观看| 中文字字幕在线高清免费电影| 亚洲午夜久久久久久久久久| 一级毛片免费观看不卡的| 亚洲va精品中文字幕| 精品国产一区二区三区免费看| 妇女自拍偷自拍亚洲精品| 亚洲乱码国产一区网址| 免费无码av片在线观看| 久久亚洲熟女cc98cm| a毛片基地免费全部视频| 国产午夜亚洲精品不卡| 国产V亚洲V天堂A无码| 99久久久国产精品免费无卡顿| 亚洲精品无码久久久久牙蜜区| 亚洲精品综合久久| 18禁止看的免费污网站| 精品久久亚洲一级α| 亚洲AV中文无码乱人伦下载| 色窝窝免费一区二区三区| jizz18免费视频| 亚洲国产成a人v在线| 区三区激情福利综合中文字幕在线一区亚洲视频1 |