WEB开发网
开发学院软件开发Java JavaEE 3层架构的 DAO, Service, Web 简单封装 阅读

JavaEE 3层架构的 DAO, Service, Web 简单封装

 2009-11-17 00:00:00 来源:WEB开发网   
核心提示:实现的逻辑大体是GeneralDAO(Interface). AbstractGeneralDAOImpl(Abstract class), GeneralService(Interface), AbstractGeneralServiceImpl(Abstract class).具体IDAO extends Gene

实现的逻辑大体是

GeneralDAO(Interface). AbstractGeneralDAOImpl(Abstract class),  GeneralService(Interface), AbstractGeneralServiceImpl(Abstract class).

具体

IDAO extends GeneralDAO,

IDAOImpl extends AbstractGeneralDAOImpl,

IService extends GeneralService,

IServiceImpl extends AbstractGeneralServiceImpl

实现代码如下.

GeneralDAO<T, ID extends Serializable>

   1:  import java.io.Serializable;
   2:  import java.util.Collection;
   3:  import java.util.List;
   4:   
   5:  import PagingVO;
   6:   
   7:  /**
   8:   * General DAO
   9:   * 
  10:   * @author Hacker-TTAO
  11:   * @version 0.1.0
  12:   */
  13:  public interface GeneralDAO<T, ID extends Serializable> {
  14:   
  15:      T findByID(ID id);
  16:   
  17:      List<T> findAll();
  18:   
  19:      PagingVO getPagingData(int currentPage, int pageSize);
  20:      
  21:      T save(T entity);
  22:      
  23:      void save(T... entity);
  24:   
  25:      T update(T entity);
  26:      
  27:      void update(Collection<T> entity);
  28:   
  29:      void saveOrUpdate(T entity);
  30:   
  31:      void saveOrUpdate(Collection<T> entities);
  32:   
  33:      void delete(T entity);
  34:      
  35:      void delete(ID id);
  36:      
  37:      void delete(Collection<T> entities);
  38:   
  39:      void marge(T eneity);
  40:      
  41:      void marge(T... eneity);
  42:      
  43:      int getCount();
  44:  }

1 2 3 4 5 6  下一页

Tags:JavaEE 架构 DAO

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接