Discussions

EJB design: WSAD and Webshphere Entity-to-entity relationship

  1. Hello,

    I recently joined a project which is going into production soon.
    They build this application without making any design (or almost any). They started coding almost immediatly and instensively used WSAD and websphere feautures.
    Amongst other, they generated a one-to-one mapping between the database and the Entity Beans. This created a complex set of inter-entity bean relationships. Every single entity is thus responsible for managing its relationships.
    I read in the book Core J2EE Patterns that it is good practice to reduce the physical relationships between entities and to leave the management of these relationships (which are part of business logic) to Session Facade.
    I try to explain this, but they are not convinced. They do not beleive that refactoring the code to use Session Facade does worth the effort. They beleive that the relationships provided by WSAD and websphere are optimized and that this will not adversly impact performance.

    As I am not a technical expert, i would like to have the point of view of so aboput these entity-to-entity relationships.

    Thanks

    Fran├žois
  2. I am not an expert in using WSAD but I did write some plugins into it. I am using Eclipse2.0, WSAD.
        I dont think creating one-to-one mapping of Enitity beans with the tables is a good practice.
        If they replicate the whole tables off into Entity Beans then what it means when the EJB2.0 spec says that the container will maintain the relationships for the developer.. ? What it means by Cmr(container managed Relationships) ??
        So its definitely not a good practice and I wonder how could they achieve the functionality without performance hit by this approach...
        Hope this helps.

    Regards,
    Kris
  3. Hello,

    Thanks for your input. This is what i think.

    I am in charge of measuring the performance of this application. I have some preliminary results and, as I expected, they are bad, but this still need to be confirmed by more accurate measurements.

    I firmly beleive that entity-bean-to-entity-bean relationship should never occurs. Not only for performance issue, but also for reusability and maintainabilty of the code.
    This is a matter of responsability:
    * session beans for business logic;
    * entity beans for accessing the database + for basic business logic that involves only the attributes of the bean (e.g. computing the total price from the quantity and unit price attributes).

    Cheers

    Fran├žois