- 作者:zhaozj
- 发表时间:2020-12-23 10:56
- 来源:未知
1.VO : 放在pub工程中,pub.vo
package com.cattsoft.demo4bss.pub.vo;
import java.io.Serializable;import org.apache.commons.lang.builder.EqualsBuilder;import org.apache.commons.lang.builder.HashCodeBuilder;import org.apache.commons.lang.builder.ToStringBuilder;
public class CompanyVO { /** identifier field */ private String id;
/** nullable persistent field */ private String name;
/** full constructor */ private String createDate; private int currentPageNo; public CompanyVO(String id, String name) { this.id = id; this.name = name; }
/** default constructor */ public CompanyVO() { }
/** minimal constructor */ public CompanyVO(String id) { this.id = id; }
public String getId() { return this.id; }
public void setId(String id) { this.id = id; }
public String getName() { return this.name; }
public void setName(String name) { this.name = name; }
public String toString() { return new ToStringBuilder(this) .append("id", getId()) .toString(); }
public boolean equals(Object other) { if ( !(other instanceof CompanyVO) ) return false; CompanyVO castOther = (CompanyVO) other; return new EqualsBuilder() .append(this.getId(), castOther.getId()) .isEquals(); }
public int hashCode() { return new HashCodeBuilder() .append(getId()) .toHashCode(); } public String getCreateDate() { return createDate; } public void setCreateDate(String createDate) { this.createDate = createDate; } public int getCurrentPageNo() { return currentPageNo; } public void setCurrentPageNo(int currentPageNo) { this.currentPageNo = currentPageNo; }}
2.DAO: 由middagen生成,自己加以修改
package com.cattsoft.new97.ejb.dao;
import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import net.sf.hibernate.Hibernate;import net.sf.hibernate.Query;import java.util.*;import net.sf.hibernate.HibernateException;
import com.cattsoft.new97.ejb.pub.BaseDAO;import com.cattsoft.new97.ejb.hibernate.*;import com.cattsoft.new97.ejb.util.*;import com.cattsoft.demo4bss.pub.util.*;import com.cattsoft.demo4bss.pub.err.*;import com.cattsoft.demo4bss.pub.vo.*;
public class CompanyDAO extends BaseDAO{
private static Log log = LogFactory.getLog(CompanyDAO.class);
public CompanyDAO() throws SysException{ }