Hi all,
I am working on my first
J2EE project. There are other developers on my team who have more experience with J2EE than me but I still have doubts as to the direction that we are taking. I would like to get feedback about some design issues.
Say I wanted to do a search for customers. What are the pros and cons of each of the following designs?
Design 1:
a. control
servlet receives request,
b. control servlet instantiates worker bean,
c. control servlet passes request to worker bean,
d. worker bean accesses database, goes through the result set and builds a results vector of CustomerData objects
e. control servlet gets the results vector from the worker bean
f. control servlet puts the results vector in the session context
g. control servlet forwards request to the view
JSP h. JSP retrieves the vector from session and displays it.
Design 2:
a. control servlet receives request,
b. control servlet instantiates Session EJB,
c. control servlet passes request to Session EJB,
d. Session EJB accesses database, goes through the result set and builds a vector of CustomerData objects
e. control servlet gets the results vector from the session EJB
f. control servlet puts the results vector in the session context
g. control servlet forwards request to the view JSP
h. JSP retrieves the vector from session and displays it.
What are the benefits of using a session bean to do business logic processing as opposed to having it in a plain old worker class? Would using a session bean make the application more scaleable? If I don't have to worry about scalability for now, is the added complexity of a Session EJB worth losing the relative simplicity of having just a worker class?
All feedback will be greatly appreciated.