posts - 325,  comments - 25,  trackbacks - 0

          1.數(shù)據(jù)表:
          orders:訂單表 customer:客戶表
          orders:
          id  int(4)    <pk>
          orderno  varchar(20)
          moeny decimal(10,2)
          customer_id int(4) <fk>

          customer:
          id int(4) <pk>
          name varchar(20)
          phone varchar(20)

          2.pojo類
          public class Customer implements Serilizable{
              private Integer id;
              private String name;
              private String phone;
              public Customer(){
              }
          }
          public class Orders implements Serilizable{
              private Integer id;
              private String orderno;
              private Double moeny;
              private Customer customer;
              public Orders(){
              }
          }

          3.hbm.xml
          Orders.hbm.xml
          <hibernate-mapping package="com.lhb.vo">
              <class name="Orders" table="orders">
                  <id name="id" column="id" type="integer">
                      <generator class="native"/>
                  </id>
                   <property name="moeny" column="moeny" type="double"/>
                  <property name="orderno" column="orderno" type="string"/>
                  <many-to-one name="customer_id" class="com.lhb.Customer" lazy="false" not-null="true"/>
              </class>
          </hibernate-mapping>
          Customer.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"/>
                  <proerty name="phone" column="phone" type="string"/>
              </class>
          </hibernate-mapping>

           

          posted on 2008-05-25 16:52 長春語林科技 閱讀(183) 評論(0)  編輯  收藏 所屬分類: hibernate
          <2008年5月>
          27282930123
          45678910
          11121314151617
          18192021222324
          25262728293031
          1234567

           

          長春語林科技歡迎您!

          常用鏈接

          留言簿(6)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          相冊

          收藏夾

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 盱眙县| 凤阳县| 郑州市| 楚雄市| 中西区| 富顺县| 台安县| 寻甸| 奉化市| 屏东县| 洞头县| 翁源县| 汉阴县| 友谊县| 信宜市| 高州市| 洞口县| 靖安县| 东丰县| 铁岭市| 天祝| 武清区| 远安县| 余江县| 城市| 神农架林区| 梨树县| 吐鲁番市| 潮安县| 乌海市| 伊宁县| 长垣县| 榆树市| 新宁县| 孟村| 广昌县| 德保县| 凤冈县| 沙田区| 库尔勒市| 西吉县|