Creating a new CMP entity bean

Create your new CMP entity bean using the Enterprise Bean Creation wizard. For each column in the corresponding database table, add a new CMP field to the bean.

Procedure

  1. Within the Project Explorer view, expand EJB Projects.
  2. Navigate to WebSphereCommerceServerExtensionsData > Deployment Descriptor:WebSphereCommerceServerExtensionsData. Right-click on Entity Beans and select New > Enterprise Bean.
  3. In the Create an Enterprise Bean window:
    1. Select Entity bean with container-managed persistence (CMP) fields.
    2. In the Bean name field, type an appropriate name, YourNewBean , for your bean. Typically, the bean name matches the name of the corresponding database table. For example, you would name the bean XUserRes to correspond to the XUSERRES table.
    3. In the Source folder field, leave the default value that is specified (ejbModule).
    4. In the Default package field, type com. yourcompany. yourcomponent.objects.
    5. From the CMP Version list, select 1.x.
    6. Click Next.
  4. Clear the Use the single key attribute type for the key class check box and click Next.
  5. In the EJB Java Class Details window:
    1. To select the bean's superclass, click Browse. The Type Selection window opens.
    2. In the Select a class using: (any) field, enter ECEntityBean and click OK. This selects the com.ibm.commerce.base.objects.ECEntityBean as the superclass.
    3. If the new enterprise bean is to be protected under the WebSphere Commerce access control framework, specify the interfaces that the remote interface should extend by clicking Add. The Type Selection window opens.
    4. In the Select a class using: (any) field, enter Protectable and click OK. This selects the com.ibm.commerce.security.Protectable. This interface is required in order to protect the new resource under access control.
    5. Click Finish.
  6. Proceed to setting the transaction isolation level for the new bean.