dto simple application introduced http://blog.csdn.net/visant

DTO is the abbreviation for Data Transfer Objects (Data Transfer Object) is. DTO mode, refers to the JavaBeans data encapsulated into a normal, J2EE transmitted between a plurality of levels. Similarly DTO messenger, the system is synchronized Message. The data model can be a JavaBeans Model.    

In conventional programming, we generally request data reception, sent to Webservice, WebService then to a database request, acquiring data, then returns layers; model is as follows:

QQ screenshot 20140320170753

The disadvantages of such a request primitive way there are many, many requests consume some network resources, slowing efficiency. If the return-time overall entity class may also cause leakage database table structure.

After using DTO model, the entire process is not the same:

QQ screenshot 20140320171127

Such benefits include:

1. The class code based on the existing can conveniently constructed DTO objects, without re-analyzed.

2. Reduce the number of requests, greatly improving efficiency.

3. Demand organization DTO object fields on the page that I need organization, no I do not organize, the entire table to avoid transmission field, improved security to some extent.

Combination of personal development experience to talk about usage:

       Generally, we use DTO class to inherit entity entity class, put some in the business field DTO class, and provide get, set method. When we use the database does not exist in some of the fields in the business logic layer or interaction layer, we need to put these fields DTO class, the significance of these fields is equivalent to some of the treated database fields, it is to facilitate meaningful data exchange and improve efficiency.

Guess you like

Origin blog.csdn.net/moye666/article/details/77453568
dto