Discussions

General J2EE: Relationship between View bean, DTO, DO/BO, DAO?

  1. In web based J2EE application, having MVC architecture, we have JSP page taking input from user in HTML form. Form data is mapped from HTTP Request into View bean using generic request mapper. This view bean is having String/String array as it's members. Now we copy the form data from view bean to domain objects using dedicated mapper. Domain object has data nd business logic. It calls broker object to persist it's state. The updated state of domain object can be mapped back to view bean, which is passed to JSP for rendering. Now we have: ViewBean, DO, DAO. Also J2EE patterns, we hear about Data Transfer Objects (DTO). 1) How all these classes should be related to each other? 2) Should we copy form data from view bean to DTO? ViewBean will have String values, DTO will have various data types. 3) How DO is related to DTO? What is type of relation association or composition? 4) What should we pass to DAO - DO or DTO? 5) The data members of DTO should be closer to client requirements? Or they should have affinity to DO terminology? 6) In case it is "record set" kind of return value, e.g. list of customers, how should we map DTO back to View bean? View bean composed of view beans?
  2. To my knowledge View bean, DTO, DO/BO abd Value Object are all simillar. DAO is used as Layer (DAO Pattern) to seperate the Persistant logic from EJB