JavaEE 3层架构的DAO,Service,Web简单封装[Java编程]
本文“JavaEE 3层架构的DAO,Service,Web简单封装[Java编程]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
实现的逻辑大体是
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: }
以上是“JavaEE 3层架构的DAO,Service,Web简单封装[Java编程]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
本文地址: | 与您的QQ/BBS好友分享! |