梦幻之旅

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 阅读(1532) 评论(0)  编辑  收藏 所属分类: Hibernate

只有注册用户登录后才能发表评论。


网站导航: