Skip Headers

Oracle® Application Server Containers for J2EE Enterprise JavaBeans Developer's Guide
10g Release 2 (10.1.2)
Part No. B15505-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

Creating BMP Entity Beans

Chapter 3, "Implementing Session Beans" shows how to develop a stateless session bean. Chapter 5, "CMP Entity Beans" describes the extra steps necessary for implementing a CMP entity bean. In a CMP bean, the primary key and all functions for persistence are performed by the container; in a BMP bean, you must implement the primary key and all functions to save the persistence of your bean. The primary key is managed in the ejbCreate method. The persistence is managed within the following functions:

The following is a summary of the steps mentioned in Chapter 5, "CMP Entity Beans" that you must do when creating your bean. See Chapter 3, "Implementing Session Beans" and Chapter 5, "CMP Entity Beans" for further details. The rest of this chapter covers how you implement the primary key and the persistence functions.

  1. Create the component interfaces for the bean. The component interfaces declare the methods that a client can invoke.

  2. Create the home interfaces for the bean. The home interface defines the create and finder methods, including findByPrimaryKey, for your bean.

  3. Define the primary key for the bean. The primary key identifies each entity bean instance and is a serializable class. You can use a simple data type class, such as java.lang.String, or define a complex class, such as one with two or more objects as components of the primary key.

  4. Implement the bean.

  5. If the persistent data is saved to or restored from a database, you must ensure that the correct tables exist for the bean.

  6. Create the bean deployment descriptor. The deployment descriptor specifies properties for the bean through XML elements.

  7. Create an EJB JAR file containing the bean, component interface, home interface, and the deployment descriptors. Once created, configure the application.xml file, create an EAR file, and deploy the EJB to OC4J.


    Note:

    This book does not cover EJB container services. See the JTA, Data Source, and JNDI chapters in the Oracle Application Server Containers for J2EE Services Guide for more information. Since transactions are not covered in this chapter, the example BMP bean uses container-managed transactions.

    For security, see the Oracle Application Server Containers for J2EE Security Guide.