servlet <-> session bean <-> entity bean

Discussions

EJB design: servlet <-> session bean <-> entity bean

  1. servlet <-> session bean <-> entity bean (1 messages)

    HI,
    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?
  2. servlet <-> session bean <-> entity bean[ Go to top ]

    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...