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

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

 2009-11-17 00:00:00 来源:WEB开发网   
核心提示: 至此. DAO 层封装完毕. 下面进行 Service 层封装GeneralService<T, ID extends Serializable, DAO extends GeneralDAO<T, ID>>1:importjava.io.Serializable;2:i

至此. DAO 层封装完毕. 下面进行 Service 层封装

GeneralService<T, ID extends Serializable, DAO extends GeneralDAO<T, ID>>

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

上一页  1 2 3 4 5 6 7  下一页

Tags:JavaEE 架构 DAO

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