JSF+Spring+Hibernate+范型DAO

DAO层:主要使用Hibernate实现持久化等相关操作。本着基类足够强大,最好可以包罗万象,避免重发开发Dao的原则,使用范型DAO来处理对数据库进行重复性的80%增删改查操作。
参考代码:

Java代码 复制代码
  1. public interface IGenericDao<T, ID extends Serializable> {   
  2.   
  3.     public void saveOrUpdate(T t);   
  4.   
  5.     public T load(Serializable ID);   
  6.   
  7.     public T get(Serializable ID);   
  8.        
  9.     public Object get(Class TClass, Serializable ID, LockMode lockMode);   
  10.   
  11.     public boolean contains(T t) throws DataAccessException;   
  12.   
  13.     public void delete(T t, LockMode lockModethrows DataAccessException;   
  14.   
  15.     public void delete(T t) throws DataAccessException;   
  16.   
  17.     public void deleteAll(Collection<T> entities) throws DataAccessException;   
  18.   
  19.     public List<T> find(String queryString, Object value)   
  20.             throws DataAccessException;   
  21.   
  22.     public List<T> find(String queryString, Object[] values)   
  23.             throws DataAccessException;   
  24.   
  25.     public List<T> find(String queryString) throws DataAccessException;   
  26.   
  27.     public List<T> findByExample(Object exampleEntity, int firstResult,   
  28.             int maxResults) throws DataAccessException;   
  29.   
  30.     public List<T> findByExample(Object exampleEntity)   
  31.             throws DataAccessException;   
  32.   
  33.     public List<T> findByNamedParam(String queryString, String paramName,   
  34.             Object value) throws DataAccessException;   
  35.   
  36.     public List<T> findByNamedParam(String queryString, String[] paramNames,   
  37.             Object[] values) throws DataAccessException;   
  38.   
  39.     public Object load(Class TClass, Serializable ID, LockMode lockMode)   
  40.             throws DataAccessException;   
  41.   
  42.     public void load(T t, Serializable ID) throws DataAccessException;   
  43.   
  44.     public Object load(String TName, Serializable ID, LockMode lockMode)   
  45.             throws DataAccessException;   
  46.   
  47.     public Object load(String TName, Serializable ID)   
  48.             throws DataAccessException;   
  49.   
  50.     public void refresh(T t, LockMode lockModethrows DataAccessException;   
  51.   
  52.     public void refresh(T t) throws DataAccessException;   
  53.   
  54.     public Serializable save(T t) throws DataAccessException;   
  55.   
  56.     public void saveOrUpdate(String TName, T t) throws DataAccessException;   
  57.   
  58.     public void saveOrUpdateAll(Collection<T> entities)   
  59.             throws DataAccessException;   
  60.   
  61.     public void update(T t, LockMode lockModethrows DataAccessException;   
  62.   
  63.     public void update(T t) throws DataAccessException;   
  64.   
  65.     public void update(String TName, T t, LockMode lockMode)   
  66.             throws DataAccessException;   
  67.   
  68.     public void update(String TName, T t) throws DataAccessException;   
  69.   
  70.     public List<T> loadAll();   
  71.        
  72.     public List<T> loadAll(Class TClass);   
  73.   
  74.     public List<T> list();   
  75.        
  76.     public List<T> list(Class TClass);   
  77.   
  78.     public PaginationSupport findPageByCriteria(   
  79.             final DetachedCriteria detachedCriteria, final int pageSize,   
  80.             final int startIndex);   
  81.   
  82.     public PaginationSupport findPageByQuery(final String hsql,   
  83.             final int pageSize, final int startIndex);   
  84.   
  85. }  
public interface IGenericDao<T, ID extends Serializable> {     public void saveOrUpdate(T t);     public T load(Serializable ID);     public T (Serializable ID);      public Object (Class TClass, Serializable ID,  );     public boolean contains(T t) throws DataAccessException;     public void delete(T t,  ) throws DataAccessException;     public void delete(T t) throws DataAccessException;     public void deleteAll(Collection<T> entities) throws DataAccessException;     public List<T> find(String queryString, Object value)     throws DataAccessException;     public List<T> find(String queryString, Object[] values)     throws DataAccessException;     public List<T> find(String queryString) throws DataAccessException;     public List<T> findByExample(Object exampleEntity, int firstResult,     int maxResults) throws DataAccessException;     public List<T> findByExample(Object exampleEntity)     throws DataAccessException;     public List<T> findByNamedParam(String queryString, String paramName,     Object value) throws DataAccessException;     public List<T> findByNamedParam(String queryString, String[] paramNames,     Object[] values) throws DataAccessException;     public Object load(Class TClass, Serializable ID,  )     throws DataAccessException;     public void load(T t, Serializable ID) throws DataAccessException;     public Object load(String TName, Serializable ID,  )     throws DataAccessException;     public Object load(String TName, Serializable ID)     throws DataAccessException;     public void refresh(T t,  ) throws DataAccessException;     public void refresh(T t) throws DataAccessException;     public Serializable save(T t) throws DataAccessException;     public void saveOrUpdate(String TName, T t) throws DataAccessException;     public void saveOrUpdateAll(Collection<T> entities)     throws DataAccessException;     public void update(T t,  ) throws DataAccessException;     public void update(T t) throws DataAccessException;     public void update(String TName, T t,  )     throws DataAccessException;     public void update(String TName, T t) throws DataAccessException;     public List<T> loadAll();      public List<T> loadAll(Class TClass);     public List<T> list();      public List<T> list(Class TClass);     public PaginationSupport findPageByCriteria(     final DetachedCriteria detachedCriteria, final int pageSize,     final int startIndex);     public PaginationSupport findPageByQuery(final String hsql,     final int pageSize, final int startIndex);    }

 

Java代码 复制代码
  1. @SuppressWarnings("unchecked")   
  2. public class GenericDao<T, ID extends Serializable> extends HibernateDaoSupport   implements IGenericDao<T, ID> {   
  3.     protected Log logger = LogFactory.getLog(getClass());   
  4.   
  5.     protected Class<T> entityClass;   
  6.   
  7.     public GenericDao() {   
  8.            
  9.     }   
  10.     protected Class getEntityClass() {   
  11.         if (entityClass == null) {   
  12.             entityClass = (Class<T>) ((ParameterizedType) getClass()   
  13.                     .getGenericSuperclass()).getActualTypeArguments()[0];   
  14.             logger.debug("T class = " + entityClass.getName());   
  15.         }   
  16.         return entityClass;   
  17.     }   
  18.   
  19.     public void saveOrUpdate(T t) {   
  20.         this.getHibernateTemplate().saveOrUpdate(t);   
  21.     }   
  22.   
  23.     public T load(Serializable ID) {   
  24.   
  25.         T load = (T) getHibernateTemplate().load(getEntityClass(), ID);   
  26.         return load;   
  27.     }   
  28.   
  29.     public T get(Serializable ID) {   
  30.         T load = (T) getHibernateTemplate().get(getEntityClass(), ID);   
  31.         return load;   
  32.     }   
  33.        
  34.     public Object get(Class TClass,Serializable ID, LockMode lockMode) {   
  35.         Object vo = getHibernateTemplate().get(TClass, ID, lockMode);   
  36.         return vo;   
  37.     }   
  38.   
  39.     public boolean contains(T t) throws DataAccessException {   
  40.         return getHibernateTemplate().contains(t);   
  41.     }   
  42.   
  43.     public void delete(T t, LockMode lockModethrows DataAccessException {   
  44.         getHibernateTemplate().delete(t, lockMode);   
  45.     }   
  46.   
  47.     public void delete(T t) throws DataAccessException {   
  48.         getHibernateTemplate().delete(t);   
  49.        
  50.     }   
  51.        
  52.     public void deleteAll(Collection<T> entities) throws DataAccessException {   
  53.         getHibernateTemplate().deleteAll(entities);   
  54.     }   
  55.        
  56.     public List<T> find(String queryString, Object value)   
  57.             throws DataAccessException {   
  58.         List<T> find = (List<T>) getHibernateTemplate().find(queryString,   
  59.                 value);   
  60.         return find;   
  61.     }   
  62.   
  63.     public List<T> find(String queryString, Object[] values)   
  64.             throws DataAccessException {   
  65.         List<T> find = (List<T>) getHibernateTemplate().find(queryString,   
  66.                 values);   
  67.         return find;   
  68.     }   
  69.   
  70.     public List<T> find(String queryString) throws DataAccessException {   
  71.         return (List<T>) getHibernateTemplate().find(queryString);   
  72.     }   
  73.   
  74.     public List<T> findByExample(Object exampleEntity, int firstResult,   
  75.             int maxResults) throws DataAccessException {   
  76.         return getHibernateTemplate().findByExample(exampleEntity, firstResult,   
  77.                 maxResults);   
  78.     }   
  79.   
  80.     public List<T> findByExample(Object exampleEntity) throws DataAccessException {   
  81.         return getHibernateTemplate().findByExample(exampleEntity);   
  82.     }   
  83.   
  84.     public List<T> findByNamedParam(String queryString, String paramName,   
  85.             Object value) throws DataAccessException {   
  86.         return getHibernateTemplate().findByNamedParam(queryString, paramName,   
  87.                 value);   
  88.     }   
  89.   
  90.     public List<T> findByNamedParam(String queryString, String[] paramNames,   
  91.             Object[] values) throws DataAccessException {   
  92.         return getHibernateTemplate().findByNamedParam(queryString, paramNames,   
  93.                 values);   
  94.     }   
  95.   
  96.     public Object load(Class TClass, Serializable ID, LockMode lockMode)   
  97.             throws DataAccessException {   
  98.         return getHibernateTemplate().load(TClass, ID, lockMode);   
  99.     }   
  100.   
  101.     public void load(T t, Serializable ID) throws DataAccessException {   
  102.         getHibernateTemplate().load(t, ID);   
  103.     }   
  104.   
  105.     public Object load(String TName, Serializable ID, LockMode lockMode)   
  106.             throws DataAccessException {   
  107.         return getHibernateTemplate().load(TName, ID, lockMode);   
  108.     }   
  109.   
  110.     public Object load(String TName, Serializable ID)   
  111.             throws DataAccessException {   
  112.         return getHibernateTemplate().load(TName, ID);   
  113.     }   
  114.        
  115.     public Object load(Class TClass, Serializable ID)   
  116.             throws DataAccessException {   
  117.         return getHibernateTemplate().load(TClass, ID);   
  118.     }   
  119.   
  120.     public void refresh(T t, LockMode lockModethrows DataAccessException {   
  121.         getHibernateTemplate().refresh(t, lockMode);   
  122.     }   
  123.   
  124.     public void refresh(T t) throws DataAccessException {   
  125.         getHibernateTemplate().refresh(t);   
  126.     }   
  127.   
  128.     public Serializable save(T t) throws DataAccessException {   
  129.         return getHibernateTemplate().save(t);   
  130.     }   
  131.   
  132.     public void saveOrUpdate(String TName, T t) throws DataAccessException {   
  133.         getHibernateTemplate().saveOrUpdate(TName, t);   
  134.     }   
  135.   
  136.     public void saveOrUpdateAll(Collection<T> entities)   
  137.             throws DataAccessException {   
  138.         getHibernateTemplate().saveOrUpdateAll(entities);   
  139.     }   
  140.   
  141.     public void update(T t, LockMode lockModethrows DataAccessException {   
  142.         getHibernateTemplate().update(t, lockMode);   
  143.     }   
  144.   
  145.     public void update(T t) throws DataAccessException {   
  146.         getHibernateTemplate().update(t);   
  147.     }   
  148.   
  149.     public void update(String TName, T t, LockMode lockMode)   
  150.             throws DataAccessException {   
  151.         getHibernateTemplate().update(TName, t, lockMode);   
  152.     }   
  153.   
  154.     public void update(String TName, T t) throws DataAccessException {   
  155.         getHibernateTemplate().update(TName, t);   
  156.     }   
  157.   
  158.     public List<T> loadAll() {   
  159.         return getHibernateTemplate().loadAll(getEntityClass());   
  160.     }   
  161.   
  162.     public List<T> loadAll(Class TClass) {   
  163.         return getHibernateTemplate().loadAll(TClass);   
  164.     }   
  165.   
  166.     public List<T> list() {   
  167.         Criteria criteria = getSession().createCriteria(getEntityClass());   
  168.         return criteria.list();   
  169.     }   
  170.   
  171.     public List<T> list(Class TClass) {   
  172.         Criteria criteria = getSession().createCriteria(TClass);   
  173.         return criteria.list();   
  174.     }   
  175.   
  176.     public PaginationSupport findPageByCriteria(   
  177.             final DetachedCriteria detachedCriteria, final int pageSize,   
  178.             final int startIndex) {   
  179.         return (PaginationSupport) getHibernateTemplate().execute(   
  180.                 new HibernateCallback() {   
  181.                     public Object doInHibernate(Session session)   
  182.                             throws HibernateException {   
  183.                         Criteria criteria = detachedCriteria   
  184.                                 .getExecutableCriteria(session);   
  185.                         int totalCount = ((Integer) criteria.setProjection(   
  186.                                 Projections.rowCount()).uniqueResult())   
  187.                                 .intValue();   
  188.                         criteria.setProjection(null);   
  189.                         List items = criteria.setFirstResult(startIndex)   
  190.                                 .setMaxResults(pageSize).list();   
  191.                         PaginationSupport ps = new PaginationSupport(items,   
  192.                                 totalCount, pageSize, startIndex);   
  193.                         return ps;   
  194.                     }   
  195.                 }, true);   
  196.     }   
  197.   
  198.     public PaginationSupport findPageByQuery(final String hsql,   
  199.             final int pageSize, final int startIndex) {   
  200.         return (PaginationSupport) getHibernateTemplate().execute(   
  201.                 new HibernateCallback() {   
  202.                     public Object doInHibernate(Session session)   
  203.                             throws HibernateException, SQLException {   
  204.                         Query query = session.createQuery(hsql);   
  205.                         int totalCount = query.list().size();   
  206.                         query.setFirstResult(startIndex);   
  207.                         query.setMaxResults(pageSize);   
  208.                         List items = query.list();   
  209.                         PaginationSupport ps = new PaginationSupport(items,   
  210.                                 totalCount, pageSize, startIndex);   
  211.                         return ps;   
  212.   
  213.                     }   
  214.                 }, true);   
  215.     }  
@SuppressWarnings("unchecked")  public class GenericDao<T, ID extends Serializable> extends HibernateDaoSupport implements IGenericDao<T, ID> {   protected Log logger = LogFactory.getLog(getClass());     protected Class<T> entityClass;     public GenericDao() {       }   protected Class getEntityClass() {    if (entityClass == null) {     entityClass = (Class<T>) ((ParameterizedType) getClass()       .getGenericSuperclass()).getActualTypeArguments()[0];     logger.debug("T class = " + entityClass.getName());    }    return entityClass;   }     public void saveOrUpdate(T t) {    this.().saveOrUpdate(t);   }     public T load(Serializable ID) {      T load = (T) ().load(getEntityClass(), ID);    return load;   }     public T (Serializable ID) {    T load = (T) ().(getEntityClass(), ID);    return load;   }      public Object (Class TClass,Serializable ID,  ) {    Object vo = ().(TClass, ID, );    return vo;   }     public boolean contains(T t) throws DataAccessException {    return ().contains(t);   }     public void delete(T t,  ) throws DataAccessException {    ().delete(t, );   }     public void delete(T t) throws DataAccessException {    ().delete(t);      }      public void deleteAll(Collection<T> entities) throws DataAccessException {    ().deleteAll(entities);   }      public List<T> find(String queryString, Object value)     throws DataAccessException {    List<T> find = (List<T>) ().find(queryString,      value);    return find;   }     public List<T> find(String queryString, Object[] values)     throws DataAccessException {    List<T> find = (List<T>) ().find(queryString,      values);    return find;   }     public List<T> find(String queryString) throws DataAccessException {    return (List<T>) ().find(queryString);   }     public List<T> findByExample(Object exampleEntity, int firstResult,     int maxResults) throws DataAccessException {    return ().findByExample(exampleEntity, firstResult,      maxResults);   }     public List<T> findByExample(Object exampleEntity) throws DataAccessException {    return ().findByExample(exampleEntity);   }     public List<T> findByNamedParam(String queryString, String paramName,     Object value) throws DataAccessException {    return ().findByNamedParam(queryString, paramName,      value);   }     public List<T> findByNamedParam(String queryString, String[] paramNames,     Object[] values) throws DataAccessException {    return ().findByNamedParam(queryString, paramNames,      values);   }     public Object load(Class TClass, Serializable ID,  )     throws DataAccessException {    return ().load(TClass, ID, );   }     public void load(T t, Serializable ID) throws DataAccessException {    ().load(t, ID);   }     public Object load(String TName, Serializable ID,  )     throws DataAccessException {    return ().load(TName, ID, );   }     public Object load(String TName, Serializable ID)     throws DataAccessException {    return ().load(TName, ID);   }      public Object load(Class TClass, Serializable ID)     throws DataAccessException {    return ().load(TClass, ID);   }     public void refresh(T t,  ) throws DataAccessException {    ().refresh(t, );   }     public void refresh(T t) throws DataAccessException {    ().refresh(t);   }     public Serializable save(T t) throws DataAccessException {    return ().save(t);   }     public void saveOrUpdate(String TName, T t) throws DataAccessException {    ().saveOrUpdate(TName, t);   }     public void saveOrUpdateAll(Collection<T> entities)     throws DataAccessException {    ().saveOrUpdateAll(entities);   }     public void update(T t,  ) throws DataAccessException {    ().update(t, );   }     public void update(T t) throws DataAccessException {    ().update(t);   }     public void update(String TName, T t,  )     throws DataAccessException {    ().update(TName, t, );   }     public void update(String TName, T t) throws DataAccessException {    ().update(TName, t);   }     public List<T> loadAll() {    return ().loadAll(getEntityClass());   }     public List<T> loadAll(Class TClass) {    return ().loadAll(TClass);   }     public List<T> list() {    Criteria criteria = getSession().createCriteria(getEntityClass());    return criteria.list();   }     public List<T> list(Class TClass) {    Criteria criteria = getSession().createCriteria(TClass);    return criteria.list();   }     public PaginationSupport findPageByCriteria(     final DetachedCriteria detachedCriteria, final int pageSize,     final int startIndex) {    return (PaginationSupport) ().execute(      new HibernateCallback() {       public Object doInHibernate(Session session)         throws HibernateException {        Criteria criteria = detachedCriteria          .getExecutableCriteria(session);        int totalCount = ((Integer) criteria.setProjection(          Projections.rowCount()).uniqueResult())          .intValue();        criteria.setProjection(null);        List items = criteria.setFirstResult(startIndex)          .setMaxResults(pageSize).list();        PaginationSupport ps = new PaginationSupport(items,          totalCount, pageSize, startIndex);        return ps;       }      }, true);   }     public PaginationSupport findPageByQuery(final String hsql,     final int pageSize, final int startIndex) {    return (PaginationSupport) ().execute(      new HibernateCallback() {       public Object doInHibernate(Session session)         throws HibernateException, SQLException {        Query query = session.createQuery(hsql);        int totalCount = query.list().size();        query.setFirstResult(startIndex);        query.setMaxResults(pageSize);        List items = query.list();        PaginationSupport ps = new PaginationSupport(items,          totalCount, pageSize, startIndex);        return ps;         }      }, true);   }

 VO: 主要使用hibernateSynchronizer工具自动生成,然后根据Hibernate Annotation进行修改。
样例代码:

Java代码 复制代码
  1. public class WorklistSetPKVO implements Serializable {   
  2.   
  3.     protected int hashCode = Integer.MIN_VALUE;   
  4.   
  5.     private java.lang.Integer processstatus;   
  6.     private java.lang.Integer key;   
  7.   
  8.   
  9.     public WorklistSetPKVO () {}   
  10.        
  11.     public WorklistSetPKVO (   
  12.         java.lang.Integer processstatus,   
  13.         java.lang.Integer key) {   
  14.   
  15.         this.setProcessstatus(processstatus);   
  16.         this.setKey(key);   
  17.     }   
  18.   
  19.   
  20.     /**  
  21.      * Return the value associated with the column: PROCESSSTATUS  
  22.      */  
  23.     public java.lang.Integer getProcessstatus () {   
  24.         return processstatus;   
  25.     }   
  26.   
  27.     /**  
  28.      * Set the value related to the column: PROCESSSTATUS  
  29.      * @param processstatus the PROCESSSTATUS value  
  30.      */  
  31.     public void setProcessstatus (java.lang.Integer processstatus) {   
  32.         this.processstatus = processstatus;   
  33.     }   
  34.   
  35.   
  36.   
  37.     /**  
  38.      * Return the value associated with the column: KEY  
  39.      */  
  40.     public java.lang.Integer getKey () {   
  41.         return key;   
  42.     }   
  43.   
  44.     /**  
  45.      * Set the value related to the column: KEY  
  46.      * @param key the KEY value  
  47.      */  
  48.     public void setKey (java.lang.Integer key) {   
  49.         this.key = key;   
  50.     }   
  51.   
  52.   
  53.   
  54.   
  55.     public boolean equals (Object obj) {   
  56.         if (null == obj) return false;   
  57.         if (!(obj instanceof WorklistSetPKVO)) return false;   
  58.         else {   
  59.             WorklistSetPKVO mObj = (WorklistSetPKVO) obj;   
  60.             if (null != this.getProcessstatus() && null != mObj.getProcessstatus()) {   
  61.                 if (!this.getProcessstatus().equals(mObj.getProcessstatus())) {   
  62.                     return false;   
  63.                 }   
  64.             }   
  65.             else {   
  66.                 return false;   
  67.             }   
  68.             if (null != this.getKey() && null != mObj.getKey()) {   
  69.                 if (!this.getKey().equals(mObj.getKey())) {   
  70.                     return false;   
  71.                 }   
  72.             }   
  73.             else {   
  74.                 return false;   
  75.             }   
  76.             return true;   
  77.         }   
  78.     }   
  79.   
  80.     public int hashCode () {   
  81.         if (Integer.MIN_VALUE == this.hashCode) {   
  82.             StringBuilder sb = new StringBuilder();   
  83.             if (null != this.getProcessstatus()) {   
  84.                 sb.append(this.getProcessstatus().hashCode());   
  85.                 sb.append(":");   
  86.             }   
  87.             else {   
  88.                 return super.hashCode();   
  89.             }   
  90.             if (null != this.getKey()) {   
  91.                 sb.append(this.getKey().hashCode());   
  92.                 sb.append(":");   
  93.             }   
  94.             else {   
  95.                 return super.hashCode();   
  96.             }   
  97.             this.hashCode = sb.toString().hashCode();   
  98.         }   
  99.         return this.hashCode;   
  100.     }   
  101. }  
public class WorklistSetPKVO implements Serializable {     protected int hashCode = Integer.MIN_VALUE;     private java.lang.Integer processstatus;   private java.lang.Integer key;       public WorklistSetPKVO () {}      public WorklistSetPKVO (    java.lang.Integer processstatus,    java.lang.Integer key) {      this.setProcessstatus(processstatus);    this.setKey(key);   }       /**    * Return the value associated with the column: PROCESSSTATUS    */   public java.lang.Integer getProcessstatus () {    return processstatus;   }     /**    * Set the value related to the column: PROCESSSTATUS    * @param processstatus the PROCESSSTATUS value    */   public void setProcessstatus (java.lang.Integer processstatus) {    this.processstatus = processstatus;   }         /**    * Return the value associated with the column: KEY    */   public java.lang.Integer getKey () {    return key;   }     /**    * Set the value related to the column: KEY    * @param key the KEY value    */   public void setKey (java.lang.Integer key) {    this.key = key;   }           public boolean equals (Object obj) {    if (null == obj) return false;    if (!(obj instanceof WorklistSetPKVO)) return false;    else {     WorklistSetPKVO mObj = (WorklistSetPKVO) obj;     if (null != this.getProcessstatus() && null != mObj.getProcessstatus()) {      if (!this.getProcessstatus().equals(mObj.getProcessstatus())) {       return false;      }     }     else {      return false;     }     if (null != this.getKey() && null != mObj.getKey()) {      if (!this.getKey().equals(mObj.getKey())) {       return false;      }     }     else {      return false;     }     return true;    }   }     public int hashCode () {    if (Integer.MIN_VALUE == this.hashCode) {     StringBuilder sb = new StringBuilder();     if (null != this.getProcessstatus()) {      sb.append(this.getProcessstatus().hashCode());      sb.append(":");     }     else {      return super.hashCode();     }     if (null != this.getKey()) {      sb.append(this.getKey().hashCode());      sb.append(":");     }     else {      return super.hashCode();     }     this.hashCode = sb.toString().hashCode();    }    return this.hashCode;   }  }  

 

Java代码 复制代码
  1. @Entity  
  2. @Table(name="")   
  3. public class WorklistSetVO  implements Serializable {   
  4.   
  5.   
  6.     // constructors   
  7.     public WorklistSetVO () {   
  8.         initialize();   
  9.     }   
  10.   
  11.     /**  
  12.      * Constructor for primary key  
  13.      */  
  14.     public WorklistSetVO (WorklistSetPKVO id) {   
  15.         this.setId(id);   
  16.         initialize();   
  17.     }   
  18.   
  19.     protected void initialize () {}   
  20.   
  21.   
  22.   
  23.     private int hashCode = Integer.MIN_VALUE;   
  24.   
  25.     // primary key   
  26.     private WorklistSetPKVO id;   
  27.   
  28.     // fields   
  29.     private java.lang.Integer re;   
  30.     private java.lang.Integer upl;   
  31.     private java.lang.Integer co;   
  32.     private java.lang.Integer lscco;   
  33.     private java.lang.Integer lscnonco;   
  34.   
  35.   
  36.   
  37.     /**  
  38.      * Return the unique identifier of this class  
  39.      * @hibernate.id  
  40.      */  
  41.     @EmbeddedId  
  42.     public WorklistSetPKVO getId () {   
  43.         return id;   
  44.     }   
  45.   
  46.     /**  
  47.      * Set the unique identifier of this class  
  48.      * @param id the new ID  
  49.      */  
  50.     public void setId (WorklistSetPKVO id) {   
  51.         this.id = id;   
  52.         this.hashCode = Integer.MIN_VALUE;   
  53.     }   
  54.   
  55.   
  56.   
  57.   
  58.     /**  
  59.      * Return the value associated with the column: RE  
  60.      */  
  61.     public java.lang.Integer getRe () {   
  62.         return re;   
  63.     }   
  64.   
  65.     /**  
  66.      * Set the value related to the column: RE  
  67.      * @param re the RE value  
  68.      */  
  69.     public void setRe (java.lang.Integer re) {   
  70.         this.re = re;   
  71.     }   
  72.   
  73.   
  74.   
  75.     /**  
  76.      * Return the value associated with the column: UPL  
  77.      */  
  78.     public java.lang.Integer getUpl () {   
  79.         return upl;   
  80.     }   
  81.   
  82.     /**  
  83.      * Set the value related to the column: UPL  
  84.      * @param upl the UPL value  
  85.      */  
  86.     public void setUpl (java.lang.Integer upl) {   
  87.         this.upl = upl;   
  88.     }   
  89.   
  90.   
  91.   
  92.     /**  
  93.      * Return the value associated with the column: CO  
  94.      */  
  95.     public java.lang.Integer getCo () {   
  96.         return co;   
  97.     }   
  98.   
  99.     /**  
  100.      * Set the value related to the column: CO  
  101.      * @param co the CO value  
  102.      */  
  103.     public void setCo (java.lang.Integer co) {   
  104.         this.co = co;   
  105.     }   
  106.   
  107.   
  108.   
  109.     /**  
  110.      * Return the value associated with the column: LSCCO  
  111.      */  
  112.     public java.lang.Integer getLscco () {   
  113.         return lscco;   
  114.     }   
  115.   
  116.     /**  
  117.      * Set the value related to the column: LSCCO  
  118.      * @param lscco the LSCCO value  
  119.      */  
  120.     public void setLscco (java.lang.Integer lscco) {   
  121.         this.lscco = lscco;   
  122.     }   
  123.   
  124.   
  125.   
  126.     /**  
  127.      * Return the value associated with the column: LSCNONCO  
  128.      */  
  129.     public java.lang.Integer getLscnonco () {   
  130.         return lscnonco;   
  131.     }   
  132.   
  133.     /**  
  134.      * Set the value related to the column: LSCNONCO  
  135.      * @param lscnonco the LSCNONCO value  
  136.      */  
  137.     public void setLscnonco (java.lang.Integer lscnonco) {   
  138.         this.lscnonco = lscnonco;   
  139.     }   
  140.   
  141.   
  142.   
  143.   
  144.     public boolean equals (Object obj) {   
  145.         if (null == obj) return false;   
  146.         if (!(obj instanceof WorklistSetVO)) return false;   
  147.         else {   
  148.             WorklistSetVO worklistSetVO = (WorklistSetVO) obj;   
  149.             if (null == this.getId() || null == worklistSetVO.getId()) return false;   
  150.             else return (this.getId().equals(worklistSetVO.getId()));   
  151.         }   
  152.     }   
  153.   
  154.     public int hashCode () {   
  155.         if (Integer.MIN_VALUE == this.hashCode) {   
  156.             if (null == this.getId()) return super.hashCode();   
  157.             else {   
  158.                 String hashStr = this.getClass().getName() + ":" + this.getId().hashCode();   
  159.                 this.hashCode = hashStr.hashCode();   
  160.             }   
  161.         }   
  162.         return this.hashCode;   
  163.     }   
  164.   
  165.   
  166.     public String toString () {   
  167.         return super.toString();   
  168.     }   
  169.   
  170.   
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值