Data Transfer Object
Encyclopedia
Data transfer object is a design pattern
used to transfer data between software application subsystems. DTOs are often used in conjunction with data access object
s to retrieve data from a database
.
The difference between data transfer objects and business objects
or data access object
s is that a DTO does not have any behavior except for storage and retrieval of its own data (accessor
s and mutator
s).
In a traditional EJB (Enterprise JavaBeans) architecture, DTOs serve dual purposes: first, they work around the problem that entity beans pre-ejb 3.0 are not serializable; second, they implicitly define an assembly phase where all data to be used by the view are fetched and marshalled
into the DTOs before returning control to the presentation tier.; a third reason of using DTOs could be that certain layers of the application should not be able to access the underlying data access object
s, and hence change the data.
Design pattern (computer science)
In software engineering, a design pattern is a general reusable solution to a commonly occurring problem within a given context in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that...
used to transfer data between software application subsystems. DTOs are often used in conjunction with data access object
Data Access Object
In computer software, a data access object is an object that provides an abstract interface to some type of database or persistence mechanism, providing some specific operations without exposing details of the database. It provides a mapping from application calls to the persistence layer...
s to retrieve data from a database
Relational database
A relational database is a database that conforms to relational model theory. The software used in a relational database is called a relational database management system . Colloquial use of the term "relational database" may refer to the RDBMS software, or the relational database itself...
.
The difference between data transfer objects and business objects
Business object (computer science)
A business object is a type of an intelligible entity being an actor inside the business layer in an n-layered architecture of object-oriented computer programs....
or data access object
Data Access Object
In computer software, a data access object is an object that provides an abstract interface to some type of database or persistence mechanism, providing some specific operations without exposing details of the database. It provides a mapping from application calls to the persistence layer...
s is that a DTO does not have any behavior except for storage and retrieval of its own data (accessor
Method (computer science)
In object-oriented programming, a method is a subroutine associated with a class. Methods define the behavior to be exhibited by instances of the associated class at program run time...
s and mutator
Mutator method
In computer science, a mutator method is a method used to control changes to a variable.The mutator method, sometimes called a "setter", is most often used in object-oriented programming, in keeping with the principle of encapsulation...
s).
In a traditional EJB (Enterprise JavaBeans) architecture, DTOs serve dual purposes: first, they work around the problem that entity beans pre-ejb 3.0 are not serializable; second, they implicitly define an assembly phase where all data to be used by the view are fetched and marshalled
Marshalling (computer science)
In computer science, marshalling is the process of transforming the memory representation of an object to a data format suitable for storage or transmission...
into the DTOs before returning control to the presentation tier.; a third reason of using DTOs could be that certain layers of the application should not be able to access the underlying data access object
Data Access Object
In computer software, a data access object is an object that provides an abstract interface to some type of database or persistence mechanism, providing some specific operations without exposing details of the database. It provides a mapping from application calls to the persistence layer...
s, and hence change the data.