夢幻之旅

          DEBUG - 天道酬勤

             :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            671 隨筆 :: 6 文章 :: 256 評論 :: 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 閱讀(1558) 評論(0)  編輯  收藏 所屬分類: Hibernate
          主站蜘蛛池模板: 霍州市| 洱源县| 仁怀市| 仁布县| 师宗县| 凤台县| 北宁市| 栾城县| 都江堰市| 太仆寺旗| 罗定市| 鄱阳县| 福贡县| 昌江| 大同县| 舟山市| 淮滨县| 惠来县| 句容市| 宁乡县| 华宁县| 山阳县| 荃湾区| 敦化市| 宝丰县| 得荣县| 开封县| 林周县| 崇信县| 平湖市| 靖宇县| 江阴市| 公主岭市| 根河市| 阜城县| 平安县| 梓潼县| 连南| 邛崃市| 榆林市| 新干县|