真善美

          勇于承擔責任; 如果你做不到,要提前跟別人說明,不要等到事情發生后再解釋。

            BlogJava :: 首頁 ::  :: 聯系 :: 聚合  :: 管理 ::
            55 隨筆 :: 0 文章 :: 29 評論 :: 0 Trackbacks
           1 <?xml version="1.0"?>
           2 <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
           3 "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
           4 <!-- 
           5     Mapping file autogenerated by MyEclipse - Hibernate Tools
           6 -->
           7 <hibernate-mapping>
           8     <!-- 類名與表名映射 -->
           9     <class name="com.cvicse.ks.mamis.common.orm.MaMaperson" table="ma_maperson">
          10         <!-- id與主鍵映射 -->
          11         <id name="id" type="java.lang.Integer">
          12             <column name="id" />
          13             <generator class="assigned" />
          14         </id>
          15         <!-- 類的屬性與表格字段名的映射 -->
          16         <!-- 也可以這樣寫<property name="pqa" column="name" type="java.lang.String"> -->
          17         <property name="pqa" type="java.lang.String">
          18             <column name="pqa" length="6" />
          19         </property>
          20         <property name="pma" type="java.lang.String">
          21             <column name="pma" length="6" />
          22         </property>
          23         <property name="ptm" type="java.lang.String">
          24             <column name="ptm" length="6" />
          25         </property>
          26         <set name="maModbaseinfos" inverse="true">
          27             <key>
          28                 <column name="pid" />
          29             </key>
          30             <one-to-many class="com.cvicse.ks.mamis.common.orm.MaModbaseinfo" />
          31         </set>
          32     </class>
          33 </hibernate-mapping>
          34 
          映射文件中主要包括三個部份:類名與表名的映射、id與數據庫表主鍵字段的映射、類屬性與表字段的映射。
           1 package com.cvicse.ks.mamis.common.orm;
           2 
           3 import java.util.Date;
           4 import java.util.HashSet;
           5 import java.util.Set;
           6 
           7 import com.cvicse.ks.mamis.common.util.CalendarUtil;
           8 
           9 /**
          10  * MaMaperson generated by MyEclipse - Hibernate Tools
          11  */
          12 
          13 public class MaMaperson implements java.io.Serializable {
          14 
          15     // Fields
          16 
          17     private Integer id;
          18 
          19     private String pqa;
          20 
          21     private String pma;
          22 
          23     private String ptm;
          24 
          25     private Set maModbaseinfos = new HashSet(0);
          26 
          27     // Constructors
          28 
          29     /** default constructor */
          30     public MaMaperson() {
          31     }
          32 
          33     /** full constructor */
          34     public MaMaperson(String pqa, String pma, String ptm, Set maModbaseinfos) {
          35         this.pqa = pqa;
          36         this.pma = pma;
          37         this.ptm = ptm;
          38         this.maModbaseinfos = maModbaseinfos;
          39     }
          40 
          41     // Property accessors
          42 
          43     public Integer getId() {
          44         return this.id;
          45     }
          46 
          47     public void setId(Integer id) {
          48         this.id = id;
          49     }
          50 
          51     public String getPqa() {
          52         return this.pqa;
          53     }
          54 
          55     public void setPqa(String pqa) {
          56         this.pqa = pqa;
          57     }
          58 
          59     public String getPma() {
          60         return this.pma;
          61     }
          62 
          63     public void setPma(String pma) {
          64         this.pma = pma;
          65     }
          66 
          67     public String getPtm() {
          68         return this.ptm;
          69     }
          70 
          71     public void setPtm(String ptm) {
          72         this.ptm = ptm;
          73     }
          74 
          75     public Set getMaModbaseinfos() {
          76         return this.maModbaseinfos;
          77     }
          78 
          79     public void setMaModbaseinfos(Set maModbaseinfos) {
          80         this.maModbaseinfos = maModbaseinfos;
          81     }
          82 }

          必須有構造方法。id的生成方式。

          posted on 2007-08-30 17:29 真善美 閱讀(305) 評論(0)  編輯  收藏 所屬分類: Hibernate學習
          主站蜘蛛池模板: 肇源县| 新营市| 任丘市| 卓尼县| 周宁县| 合江县| 天津市| 正蓝旗| 浑源县| 唐河县| 阿拉善盟| 舒城县| 湘潭县| 社旗县| 屯门区| 梓潼县| 邮箱| 武城县| 华坪县| 杭锦旗| 汶上县| 页游| 文成县| 靖西县| 祁连县| 铅山县| 延长县| 永和县| 抚州市| 滨州市| 遂溪县| 澄城县| 且末县| 保定市| 玉龙| 大理市| 东阿县| 铜鼓县| 城步| 册亨县| 金门县|