Q&A

Q1:What are the coding differences between a bean-managed persistence bean and a container-managed persistence bean?
A1: The following are the coding differences between the two types of entity beans:
  • With BMP, the developer is responsible for writing the database access calls. With CMP, the container is responsible for database access.

  • The BMP bean class is not defined as abstract class. The CMP bean class is defined as an abstract class.

  • The persistent state in a BMP is defined as instance variables. In CMP, you write public abstract accessor methods for persistent and relationship fields.

  • A BMP implements all the finder methods in the bean class. A CMP bean class does not implement the finder methods. The queries for the finder methods are ...

Get Sams Teach Yourself EJB in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.