夢(mèng)幻之旅

          DEBUG - 天道酬勤

             :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            671 隨筆 :: 6 文章 :: 256 評(píng)論 :: 0 Trackbacks
          Customer.java
          package org.roadway.wisp.test;

          import java.io.Serializable;
          import java.util.Date;
          import java.util.HashSet;

          /**
           * @hibernate.class table="ZD_COSTOMER"
           
          */
          public class Customer implements Serializable
          {
              
          private static final long serialVersionUID = 939548333216539319L;
              
              
          private Long              customerId;
              
              
          private String            customerName;
              
              
          private Date              birthday;
              
              
          private HashSet<Order>    orders;
              
              
          /**
               * @hibernate.id generator-class="sequence" column="CUSTOMER_ID"
               *               unsaved-value = "null"
               * @hibernate.generator-param name="sequence" value="SQ_PERSON_ID"
               * 
               * 
          @return
               
          */
              
          public Long getCustomerId()
              {
                  
          return customerId;
              }
              
              
          /**
               * @hibernate.property column="CUSTOMER_NAME" length="32" not-null="true"
               
          */
              
          public String getCustomerName()
              {
                  
          return customerName;
              }
              
              
          /**
               * @hibernate.property column="BIRTHDAY"
               
          */
              
          public Date getBirthday()
              {
                  
          return birthday;
              }
              
              
          /**
               * @hibernate.set table="ZD_ORDER" lazy="true" inverse="true"
               * @hibernate.key column="CUSTOMER_ID"
               * @hibernate.one-to-many class="org.roadway.wisp.test.Order"
               
          */
              
          public HashSet<Order> getOrders()
              {
                  
          return orders;
              }
              
              
          public void setCustomerId(Long customerId)
              {
                  
          this.customerId = customerId;
              }
              
              
          public void setCustomerName(String customerName)
              {
                  
          this.customerName = customerName;
              }
              
              
          public void setBirthday(Date birthday)
              {
                  
          this.birthday = birthday;
              }
              
              
          public void setOrders(HashSet<Order> orders)
              {
                  
          this.orders = orders;
              }
          }
          Order.java
          package org.roadway.wisp.test;

          import java.io.Serializable;

          /**
           * @hibernate.class table="ZD_ORDER"
           
          */
          public class Order implements Serializable
          {
              
          private static final long serialVersionUID = 8989273619109202636L;
              
              
          private Long              orderId;
              
              
          private String            orderName;
              
              
          private Double            money;
              
              
          private Customer          customer;
              
              
          /**
               * @hibernate.id generator-class="sequence" column="ORDER_ID" unsaved-value =
               *               "null"
               * @hibernate.generator-param name="sequence" value="SQ_ORDER_ID"
               * 
               * 
          @return
               
          */
              
          public Long getOrderId()
              {
                  
          return orderId;
              }
              
              
          /**
               * @hibernate.property column="ORDER_NAME" length="32" not-null="true"
               
          */
              
          public String getOrderName()
              {
                  
          return orderName;
              }
              
              
          /**
               * @hibernate.property column="MONEY" not-null="true"
               
          */
              
          public Double getMoney()
              {
                  
          return money;
              }
              
              
          /**
               * @hibernate.many-to-one column="teacher_id" not-null="true"
               
          */
              
          public Customer getCustomer()
              {
                  
          return customer;
              }
          }
          xdoclet.xml
          <?xml version="1.0"?>
          <project name="xdoclet" default="hibernate.mapping.generate" basedir=".">
              
          <property name="project.src" value="test"/>
              
          <property name="po.package" value="org/roadway/wisp/test"/>
              
          <property name="xdoclet.lib" value="E:/user_hvp/xdoclet-plugins-dist-1.0.4/lib"/>
              
          <path id="xdoclet.task.classpath">
                  
          <fileset dir="${xdoclet.lib}">
                      
          <include name="*.jar" />
                  
          </fileset>
                  
          <pathelement location="${xdoclet.lib}/xdoclet-plugin-hibernate-1.0.4.jar" />
              
          </path>
              
          <taskdef name="xdoclet" classname="org.xdoclet.ant.XDocletTask" classpathref="xdoclet.task.classpath" />
              
          <target name="hibernate.mapping.generate">
                  
          <xdoclet>
                      
          <fileset dir="${project.src}">
                          
          <include name="${po.package}/*.java" />
                      
          </fileset>
                      
          <component classname="org.xdoclet.plugin.hibernate.HibernateMappingPlugin" destdir="${basedir}/${project.src}" version="3.0" />
                  
          </xdoclet>
              
          </target>
          </project>
          xdoclet1.x不支持泛型,xdoclet2支持!!
          posted on 2008-10-20 19:21 HUIKK 閱讀(1559) 評(píng)論(0)  編輯  收藏 所屬分類: Hibernate
          主站蜘蛛池模板: 资阳市| 嘉兴市| 洮南市| 逊克县| 德保县| 温州市| 阿城市| 新乡县| 黔南| 常州市| 栖霞市| 柳州市| 恩平市| 和田县| 东乡族自治县| 长兴县| 固阳县| 滨海县| 拜泉县| 元谋县| 辉县市| 阜康市| 青阳县| 视频| 红河县| 阿城市| 安吉县| 红安县| 香河县| 自治县| 奉贤区| 富裕县| 宿松县| 高州市| 晋宁县| 天峻县| 城步| 阿克苏市| 前郭尔| 会宁县| 尼木县|