Benefit of Entity Bean

Discussions

EJB design: Benefit of Entity Bean

  1. Benefit of Entity Bean (4 messages)

    I've read many discussion of using Entity Bean(both CMP and BMP).It seems that there is quite a performance punishment. Then, I have come with very generic question. Why do we need to use Entity Bean? Is there any advantage of an Entity over Java Object with sql statement?


    Paul

    Threaded Messages (4)

  2. Benefit of Entity Bean[ Go to top ]

    Hi paul,
    there are lots of advantages of entity bean over ordinary java object.

    if u use CMP....
    1) u need not write any jdbc statements reducing the development time in many folds.
    2) u can set the transaction management without writing one line of code.
    3) u can set the isolation levels.
    4)u can make use pools of entitybeans which makes it efficient.
    5) u can use the security provided by the application server.
    ...
    ....

    i think thses things are enough to choose an entity bean over a ordinary java object.

    thanks,
    subbu



  3. Benefit of Entity Bean[ Go to top ]

    I agree with you if I can use CMP. However, CMP cannot work for join table, which is needed in many application. Therefore, I think I must use BMP. Can you discuss a little more about BMP's(instead of CMP) advantage over ordinary java object?


    Paul
  4. Benefit of Entity Bean[ Go to top ]

    Can someone explain to me why CMP cannot work for a join table?

    Thanks,
    Ciaran
  5. Benefit of Entity Bean[ Go to top ]

    Other advantages are that Entity Beans become components, and can be moved to different systems, plugged into different containers.

    Entity beans allow fine-grained transactional management without you having to worry about providing the transactional demarcation.

    Entity beans (through the container) also offer connection pooling, caching of beans, access to mail services, messaging services, etc. All of which are performance boosts.

    Entity beans do not need to have terrible performance. For example, Weblogic 5.1 has a field in the weblogic-ejb.xml file that you can specify an is-modified method. Weblogic will call this method after every business method to see if it needs to do a save/load. In your business methods, you can then set a flag to indicate if the object is dirty (and needs a save/load) or clean. The is-modified method returns this flag, of course.

    David