Bean or Container Managed Persistence

R

Ray

Hi,

I've been reading up on the Sun J2EE tutorial. One of the topics there
is bean or container managed persistence. It states that container
managed is easier for developers and allows for more portability. The
class codes are much smaller compared to bean managed and developers
need not worry about database queries.

Can anyone share their experiences on this? Any 'Real World'
advantages and disadvantages? Is there a guideline I can follow when
to use bean or container managed persistence?

Thanks,

-Ray
 
D

Dobromir Gaydarov

Ray said:
Hi,

I've been reading up on the Sun J2EE tutorial. One of the topics there
is bean or container managed persistence. It states that container
managed is easier for developers and allows for more portability. The
class codes are much smaller compared to bean managed and developers
need not worry about database queries.

Can anyone share their experiences on this? Any 'Real World'
advantages and disadvantages? Is there a guideline I can follow when
to use bean or container managed persistence?

First, it depends if you are at EJB 1.x or at EJB 2.x.

- Within EJB 1.x BMP was supposed to deal with persisting complex object to
multiple tables. The object were supposed to be course grained and therefore
the complex the better. Therefore CMP was not sufficient / efficient for
handling the persistence.

- Within EJB 2.x the issue with the complex object is gone - now you are
encouraged to use fine grained CMP beans and CMR between them. Since the
objects are less complicated and the local interfaces made the CMR possible
the combination CMP plus CMR is powerfull enough.

The guideline now (in EJB 2.x container) is:
If your persistent store is a relational database CMP/CMR approach is more
than sufficient.
If your persistent store is something more complicated, like a mainframe
application, then you have to use BMP or J2CA.

The assumption is that using BMP against a relational database you can not
achieve better results compared to the CMP/CMR support already implemented
by the container. Nobody will stop you from trying to prove that assumption
wrong ;-)

Regards,
Dobromir
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top