# How Do I: Add a Create Method to an Entity Bean?

To add a create method to a CMP entity bean, you must have defined CMP fields, including at least one primary key. For more information, see How Do I: Define a Container-Managed Persistence (CMP) Field?

To Add a Create Method

1. Make sure that the entity bean is displayed in Design View.
2. Right-click the right-hand area of the bean, and choose Add EJBCreate. The Add ejbCreate method dialog appears.

4. Select the CMP fields that need to be initialized by the new EJBCreate method. Click OK.

The ejbCreate method is created and appears in Design view. Click the method name to view its source code. Notice that the corresponding ejbPostCreate method is also created.

Related Topics

How Do I: Define a Container-Managed Persistence (CMP) Field?

Developing Enterprise JavaBeans