Dao,service,web simple encapsulation of Java EE 3-tier architecture

Source: Internet
Author: User

The logic of implementation is generally

Generaldao (Interface). Abstractgeneraldaoimpl (abstract Class), Generalservice (Interface), Abstractgeneralserviceimpl (abstract class).

Specific

Idao extends Generaldao,

Idaoimpl extends Abstractgeneraldaoimpl,

IService extends Generalservice,

Iserviceimpl extends Abstractgeneralserviceimpl

The implementation code is as follows.

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: *
: * @author hacker-ttao
: * @version 0.1.0
12: */
13:public interface generaldao<t, ID extends serializable> {
:
15:t FindByID (ID ID);

17:list<t> findall ()
:
19:pagingvo getpagingdata (int currentpage, int pageSize);

21:t Save (T entity)
:
23:void Save (T ... entity);
:
25:t update (t entity); br>:
27:void update (collection<t> entity)
:
29:void saveorupdate (T entity);
30:
31:void Saveorupdate (collection<t> entities);
:
33:void Delete (T entity),
:
35:void Delete (ID ID),
:
37:void Delete (Col lection<t> entities);
:
39:void Marge (T eneity);
:
41:void Marge (T. eneity);
:
43:int getcount ();
:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.