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
- Within the Project Explorer view, expand EJB Projects.
- Navigate to Entity Beans and select . . Right-click on
- In the Create an Enterprise Bean window:
- Select Entity bean with container-managed persistence (CMP) fields.
- 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.
- In the Source folder field, leave the default value that is specified (ejbModule).
- In the Default package field, type
com. yourcompany. yourcomponent.objects
. - From the CMP Version list, select 1.x.
- Click Next.
- Clear the Use the single key attribute type for the key class check box and click Next.
- In the EJB Java Class Details window:
- To select the bean's superclass, click Browse. The Type Selection window opens.
- 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. - 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.
- 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. - Click Finish.
- Proceed to setting the transaction isolation level for the new bean.