Creating the access bean

An access bean acts as a wrapper for the enterprise bean that simplifies how other components interact with the enterprise bean. You must create an access bean for your new enterprise bean. The tools in Rational Application Developer are used to generate this access bean, based upon the entity that you have already created (in particular, only methods that have been promoted to the remote interface will be used by the access bean).

Before you begin

You modified the schema name.

About this task

To create the access bean:

Procedure

  1. Click File > New > Access Bean.
  2. In the Add an Access Bean window, select Copy helper and click Next.
  3. From the EJB Project list, select your EJB project.
  4. Select the yourNewBean bean and click Next.
  5. From the Constructor method drop-down list, select findByPrimaryKey( yourPackageName. yourNewBeanKey) as the constructor method.
  6. Select all attributes in the Attribute Helpers section.
  7. Click Finish.
  8. Save your work.
  9. In the EJB Deployment Descriptor Editor, in the Overview tab, scroll down to the JNDI - CMP Connection Factory Binding section and in the JNDI name field enter the value that matches your database type. For example, if your instance name is demo, enter the following values:
    • Apache Derby jdbc/WebSphere Commerce Cloudscape DataSource demo
    • jdbc/WebSphere Commerce DB2 DataSource demo
    • jdbc/WebSphere Commerce iSeries DataSource demo
    • jdbc/WebSphere Commerce Oracle DataSource demo
      The following screen capture is an example using a Cloudscape database:
      Example using a Cloudscape database
  10. Save your changes.
  11. Proceed to generating the deployed code, or optionally, if you want to use the optimistic locking migration tool proceed to migrating EJB projects to use optimistic locking then to generating the deployed code. See the coding practices section of Creating new entity beans for more information.