Retrieving data from multiple tables using a single BMP

Discussions

EJB design: Retrieving data from multiple tables using a single BMP

  1. I am very eager to know the about the following design pattern.

    In Bean Managed Entity beans, SQLS must be explicitly specified in the implementation class for loading, inserting, updating and deleting. Assume that there are two tables Employee and Address. Employee table contains the employee info and the address id of the employee. The Address table contains the actual address.

    The Application requires an Employee Object, which contains Address object. This Java object is created by a session bean depending on two entity beans EmployeeBean and AddressBean.

    My question is Why can't we create one entity bean called EmployeeBean , which pulls out information from both employee and adrees table, so that we can get rid of the other entity { That is using join in the bean sql statement}. Ofcourse one can come up with reasons like , in the case of just address modification, we have to load all the records. But my interest is whether this design pattern is correct? Is there any flaw? any body has tried out this patter and what was the outcome?

    Thanks
    suresh.
  2. Your question is sensible. I have asked in so many discussion forums that how u implement master/detail scenario. Like the one explained above. But no reply. I know we can implement it using BMP bean. But is there any way to implement in CMP. waiting for some feedback.