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)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          相冊

          收藏夾

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 兴城市| 东阿县| 罗江县| 汝南县| 沽源县| 苏州市| 威宁| 苍梧县| 勃利县| 河北省| 徐汇区| 东平县| 吴旗县| 班戈县| 轮台县| 唐海县| 台东市| 河西区| 五原县| 新民市| 上犹县| 甘南县| 灵璧县| 武义县| 北票市| 岐山县| 布拖县| 罗平县| 衡东县| 曲周县| 沙洋县| 大荔县| 通州市| 米脂县| 定远县| 获嘉县| 蒙自县| 通州区| 海盐县| 四子王旗| 岳西县|