how to design for this problem

Discussions

EJB design: how to design for this problem

  1. how to design for this problem (2 messages)

    Hi !


     i am just started doing ejb.i don't know which bean i have to use in my requirement.

    i have to call ejb in my jsp page.in my project we are retrieving the values from three tables and displaying in a table in jsp.in this jsp we have three buttons to add,delete and modify.i think i can use statelesssession bean for this requirement.am i correct or not.if anybody have this type of problem please give ur reply asap.and send ur code for my sample.

    hima
  2. U could wrap your entity beans or SQL code in a stateless session bean using three methods , delete, update and moidfy but u could also use entity beans directly in the JSP if there is no transactional queries being fired here.

  3. Hi,

    You can use stateless bean in your case. Probably, this stateless bean will have three methods: one for each operation (add, delete, modify). Inside your methods you will have calls to your entity beans set and get methods and maybe create and remove methods.

    In case if you need to keep some information during operation (Example: user id and password for security or auditing), then you need use Statefull session bean and call your entity bean from methods of this statefull bean. Or you can use Java Bean in session scope in your JSP that will look like Statefull Session Bean but without transaction management. Last option is not the best, because you alse need to provide from your Java Bean access to the your Entity Bean directly or via middle stateless session bean and it is requires extra work and also you mixing tiers (bussines and presentation) of the application.

    Best regards,

    Taras