Hi Friends,
I have a design question in Spring 3.Here is the background..
1. Currently our project is using Spring Core,Spring MVC, EJB3 and JSP.
2. The persistent layer is through - JPA entities. We have used bottom up approach, as we have to create application using existing database,
3. The flow is like this
1. Dispatcher Servlet takes the request, passes the request to corresponding controller.
2. The controller uses the Service objects to interact with enterprise beans and create the business objects. Here business objects represent generic objects which are used across the application.
3. Value Objects are responsible for presentation layer. These objects have one to one mapping between the UI elements.
4. Mapper classes are responsible to map/fill the Value Objects from the result of Service Class calls.
5. We are creating value objects with one to one mapping of screen elements.These UI elements are the result of JPA entities. i.e., based on input from the UI, a disticnt object/row of an entity represent what to
display on the UI.
6. Currently, one UI screen contains the result of different entities. For example Employee screen contains Employee object, Employee expense details object and Employee Expense details object.
These object contains distinct elements.On top of it, Summary page contains diffent objects of these kind.
Question:-
My question is, if I create a corresponding VO for Employee, Expense, Employer, how to combine these objects. I mean, if I start creating VO's like this.. suppose if UI contains 10 different sections with 10 elements of each, data pulled from different tables, then I may end up creating a VO with 100 elements. So I felt creating VO for each section would make sense.
How to relate these VO objects from creation of VO to display in JSP. I can not come up with business objects for the sake of UI.
Is there any design pattern ?
Thanks,
Suresh.