EJB design: servlet <-> session bean <-> entity bean
- Posted by: Mike Lee
- Posted on: November 24 2002 22:26 EST
i have a question about a design problem.
i am using a servlet to call a session bean, then entity bean..
the session bean will return a entity of the entity bean,
will i return the 'local' class of the entity bean to servlet??
or do i need to create a new class which have corresponding get and set method as the entity bean, and return this??
or can i return a string that contain info as this format XXX-XXX-XXX and split it again in servlet?
what is the correct solution?
You should create a Serializable class with getters (and setters if you need to update or create). Have the entity bean return that to the session bean which will return it to the servlet.
You could also send back an XML stream and have the servlet transform it (XSL) to HTML or whatever your presentation markup is...