Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Section 4: Business Tier Technologies

2. [Explain and contrast the following persistence strategies: container-managed persistence


(CMP) BMP, JDO, JPA, ORM and using DAOs (Data Access Objects) and direct JDBC technology-
based persistence under the following headings: ease of development, performance, scalability,
extensibility, and security]

[A] Container managed persistence:

Ease of development Container handles persistence chores automatically. Instead of writing


Java code to implement bean-managed persistence, you describe container-managed
persistence declaratively in the deployment descriptor file. With CMP, lazy loading happens
automatically behind the scenes. The container will automatically handle referential integrity for
you. The fields are not present. Rather, the container generates your persistent fields in the
subclass. The container generates JDBC code for us. You declare the way you would like your
relationships to work in your deployment descriptor.

Performance
CMP can make many optimizations: optimal locking; optimistic transactions; efficient lazy
loading; efficiently combining multiple queries to the same table (i.e. multiple beans of the same
type can be handled together); optimized multi-row deletion to handle deletion of beans and
their dependents. BMP should always win out over CMP in performance. With CMP, lazy loading
happens automatically behind the scenes.

Scalability

Extensibility Stuck with container’s idea of persistence. Less flexible

Security managed by the container based on the DD.

You might also like