Java Reference
In-Depth Information
DTO s to pass data to the DAO s in order to update the database. They are also
returned by the transactions scripts to the presentation tier.
DTO s are simple data holders and only have fields and getters. The DTO s and
their fields can be identified in one of three ways:
Define a DTO for each database table that has fields corresponding to the
table's columns.
Define a DTO for each screen whose fields contain the data that is displayed
on the screen.
Perform simple OO analysis and design techniques to identify the classes
and their fields.
For this particular use case, we can apply a combination of these techniques and
get the DTO s shown in figure 9.5.
The names of these DTO s, their fields, and their associations are very similar to
the names, fields, and associations of the classes in the domain model described
earlier in chapter 3. However, one very important difference is that unlike the
domain model classes, they do not implement any business logic. Listing 9.3
shows an excerpt of the source code for the PendingOrderDTO that illustrates the
simple structure of a DTO .
PendingOrder
DTO
PendingOrder
LineItemDTO
Address
pendingOrderId
state
deliveryTime
quantity
Payment
Information
Restaurant
Summary
DTO
MenuItem
DTO
Restaurant
DTO
menuItemId
name
price
restaurantId
name
restaurantId
name
Figure 9.5
Design of the details classes
Search WWH ::




Custom Search