Is there a difference between Model and DTO/Data ?

First of all, DTO and Data file means the same thing.

Model is something which is generated on build. An entry of the attribute/item is done in xml file, build is done and Model file is created. It has all the attribute defined with their setters and getters.

DTO/data file(also known as pojo file in some cultures :P) is something created manually by the user. It also has attributes defined with their setters and getters.

Model is generally used to update the database with the values. DTO/data is used to transfer object values b/w controller to jsp or between various layers(controller, facade, service etc). I reason being that DTO/data are generally considered as “lighter” components comapared to models. The latter thus is used for only updation of database rather than general passing of the data between files. 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s