Home > Articles > Programming > Java

  • Print
  • + Share This
From the author of

Technical Differences

The technical differences between BMP and CMP come right down to who is responsible for writing the persistence code for the bean: the EJB container or the bean developer.

When the EJB container manages the data persistence, you as the bean developer, must do the following:

  • Build a custom deployment descriptor for each application server your bean is being deployed on, specifying the mapping between your bean and its fields to a database table and its columns.

  • Use a proprietary protocol and mechanism (EJB 1.1 only; EJB 2.0 offers a generic solution) to build any custom finder methods that you want to use to search for instances of your beans.

When you, the bean developer, manage the persistence of the bean's data, you must respond to container notifications and perform the following tasks:

  • Create a new instance of your data (usually insert a row into a table in the database).

  • Remove an instance of your data (usually delete a row from a table in the database).

  • Update an instance of your data (usually update a row from a table in the database).

  • Perform all queries (manually implement all finder methods, including the standard findByPrimaryKey() method).

  • Take appropriate actions when your bean will be passivated.

  • Take appropriate actions when your bean will be activated.

  • + Share This
  • 🔖 Save To Your Account