How to use entity beans (EJB 2.0) appropiately?


EJB programming & troubleshooting: How to use entity beans (EJB 2.0) appropiately?

  1. Hi,

    I'd like to know I have to use entity beans correctly.
    I know that an entity bean usually maps to a table row in the DB. I think that's not to complicated using CMP.
    But I often read that entity beans should not be fine- but
    coarse-grained for performance reasons. I also understand that. But how can I realize that? Can anyone point me to some samples how to use Composite Entity Beans?
    I also wonder if this strategy can be realized using CMP.
    I think not. Please correct me, if I'm wrong.
    I want to use J2EE 1.3 RI with EJB 2.0.

    Any hints greatly appreciated...

  2. As far as my knowledge goes wether to coarse grain or fine grain ur beans is entirely subjective.It really depends on the needs of ur particualr application.Also what are Composite Entity Beans?is this something new introduced in EJB2.0?im not really aware of all the new features of 2.0.

    Floyd Marinescu presented an excellent argument between fine and coarse grained behaviour.I would highly recommend it to your attention.

    Also note that i have attempted to answer your question in as much of an effort to solve ur problem as to learn more myself.So please correct me if im wrong.Feedback will be much appreciated.

  3. Hi,

    'Composite Entity Bean is a pattern described in 'Core J2EE Patterns. I understand the concept behind that pattern. But
    I do not know how to implement it using CMP (if possible) or BMP. Any examples would be great.

  4. Hi Frank,

    I'm not an expert myself and just start getting into the EJB topic. But I agrre with you that the Composite Entity Bean pattern can not be implemented using CMP.

    Floyd Marinescu gives a further discussion on that topic in his book "EJB Design Patterns" starting on page 199.