Discussions

EJB design: Which Bean we choose?

  1. Which Bean we choose? (4 messages)

    Hello

    i am new to EJB. i have knowledge about how to deploy Session Beans and Entity Beans.

    But i do not know when I choose Session Beans or Entity Beans

    If it is Entity Bean, when we use BMP or CMP.

    If you have any links for the above, please provide.

    Please advice.

    Advance Thank you.

    Ranjitha

    Threaded Messages (4)

  2. Reply : Which Bean we choose?[ Go to top ]

    It depends on your requirement

    Entity Beans - Use
    1. when you want a tight coupling between the database and the application
    2. when you have proper expertise/infrastructure/cluster environments,etc.

    CMP - use when you dont want to write the sql queries for CRUD (create,read,update,delete) operations. Also, if using Entity Bean, CMP is the best choice in current scenario as CMP 2.0(as per my info) is more efficient as compared to previous version.

    BMP - use when you want to write sql queries urself (executing procedures,etc. which are not possible in CMP). Also, in BMP there is less worry if any time there's an environment change in the form of Application Server i.e., it is a less pain in BMP and more pain in CMP.


    Going by the current practices, Session Beans are the most used, however after the recent evolution of CMP, peopl have started using CMP as well..
  3. Which Bean we choose?[ Go to top ]

    Use Session Bean to represent a task/processing like User Registration etc.

    Entity Beans for object like User, Student etc. which has to persist somewhere.

    Use BMP:
    If and only if,
    - You need to retrieve data from some kind of source which is not supported by CMP.
    - You have to do major data manipulate before/after saving/retrieving from/to source.
    - Have to get the consolidated data from different sources.

    ..and so on...

    Otherwise, keep your life easy with CMP or best with Hibernate or JDO.

    Regards
    Amit
  4. Which Bean we choose?[ Go to top ]

    Thank you for your information.

    i got more knowledge about subject.

    Could you have any particular site about this, please let me know.

    Thanks once again
  5. Which Bean we choose?[ Go to top ]

    Go to the free books section in this site and download mastering ejb3 free pdf;)
    That explains this stuff than anything else;)
    Regards