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: 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: }
更多精彩
赞助商链接