Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1503524
  • 博文数量: 3500
  • 博客积分: 6000
  • 博客等级: 准将
  • 技术积分: 43870
  • 用 户 组: 普通用户
  • 注册时间: 2008-05-03 20:31
文章分类

全部博文(3500)

文章存档

2008年(3500)

我的朋友

分类:

2008-05-04 20:24:50

一起学习
首先你要下载xdoclet-1.2.3,ant1.6.5,然后写项目管理文件build.properties,build.xml。 举例如下: build.properties内容: xdoclet.lib=E:/xdoclet-1.2.3/lib build.xml内容: javabean如下: package net.pms.model; import java.io.Serializable; import java.util.Date; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.EqualsBuilder; /** * * @author jfish * @hibernate.class table="person" */ public class Person implements Serializable { private static final long serialVersionUID = 1044237873392048222L; private Long id; private String name; private Date createTime; /** * @return Returns the createTime. * @hibernate.property column = "ts" */ public Date getCreateTime() { return createTime; } /** * @param createTime * The createTime to set. */ public void setCreateTime(Date createTime) { this.createTime = createTime; } /** * @return Returns the id. * @hibernate.id column = "person_id" generator-class = "native" * unsaved-value = "not null" */ public Long getId() { return id; } /** * @param id * The id to set. */ public void setId(Long id) { this.id = id; } /** * @return Returns the name. * @hibernate.property */ public String getName() { return name; } /** * @param name * The name to set. */ public void setName(String name) { this.name = name; } /** * @see java.lang.Object#toString() */ public String toString() { return new ToStringBuilder(this).append("name", this.name).append("id", this.id).append("createTime", this.createTime).toString(); } /** * @see java.lang.Object#hashCode() */ public int hashCode() { return new HashCodeBuilder(-96436153, 713792057).appendSuper( super.hashCode()).append(this.createTime).append(this.name) .append(this.id).toHashCode(); } /** * @see java.lang.Object#equals(Object) */ public boolean equals(Object object) { if (!(object instanceof Person)) { return false; } Person rhs = (Person) object; return new EqualsBuilder().appendSuper(super.equals(object)).append( this.createTime, rhs.createTime).append(this.name, rhs.name) .append(this.id, rhs.id).isEquals(); } } 生成的映射文件如下: 下载本文示例代码


用xdoclet生成hibernate映射文件用xdoclet生成hibernate映射文件用xdoclet生成hibernate映射文件用xdoclet生成hibernate映射文件用xdoclet生成hibernate映射文件用xdoclet生成hibernate映射文件用xdoclet生成hibernate映射文件用xdoclet生成hibernate映射文件用xdoclet生成hibernate映射文件用xdoclet生成hibernate映射文件用xdoclet生成hibernate映射文件用xdoclet生成hibernate映射文件
阅读(62) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~