Sams Teach Yourself BEA WebLogic Server 7.0 in 21 Days

During the last two days, you studied session beans, which are the support provided by the EJB specification for writing and deploying transactional business components. Enterprise applications require transactional as well as persistence functionality. For persistence functionality, the EJB specification defines another type of bean called an entity bean. An entity bean represents the data logic part of an enterprise application.

Entity beans are components that encapsulate database activities such as retrieving and storing data in a database. Entity beans interact with the database for persisting data in different ways depending on who is responsible for implementing the database functionality. The EJB specification defines two ways to implement database functionality for an entity bean:

  • Container Managed Persistence (CMP) The EJB container is responsible for generating the desired database functionality of the entity bean. Generally, a vendor of an EJB container provides tools to automate the generation of the classes for the database functionality.

  • Bean Managed Persistence (BMP) The bean provider (which means you!) implements the database functionality, essentially writing the SQL queries to access the database.

There are pros and cons to each method and there are also applicability issues for entity beans. Through your lessons over these two days, you will become familiar with CMP and BMP.

Категории