Search This Blog

Wednesday, October 26, 2005

Advantage of BMP over CMP Beans

Bean Managed persistence is an alternative to using container managed persistence. Just as the name implies, it allows the bean to persist the instance in which the bean developer must implement. The goals of bean managed persistence are slightly more nebulous. For example, anything you cannot accomplish in a container managed persistence bean, you can accomplish in a bean managed persistence component. Some of these include the following:
  • You might have specific JDBC features that are required for your DBMS vendor. For example, you might need to accomplish your persistence with stored procedures or bulk inserts. Note: Some vendors have added stored procedure communication to container managed persistence.

  • You might have proprietary object-to-relational mapping provided by another tool. For example, TopLink is a popular object mapping tool that generates the code for bean managed persistence.

  • You might need to encapsulate communicating to a nonrelational data store. For example, you might want to communicate to a mainframe or mini using a proprietary data store for a given application.

It is unlikely that you cannot accomplish all of an application's persistence requirements using container managed persistence. The EJB 2.0 specifications include many new features for CMP beans that make BMP almost obsolete in most occasions.

No comments: