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).
About this task
To create the access bean:
Procedure
- Click File > New >
Access Bean.
- In the Add an Access Bean window, select Copy
helper and click Next.
- From the EJB Project list, select
your EJB project.
- Select the yourNewBean bean and
click Next.
- From the Constructor method drop-down list, select findByPrimaryKey( yourPackageName.
yourNewBeanKey) as the constructor
method.
- Select all attributes in the Attribute Helpers section.
- Click Finish.
- Save your work.
- 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:
-
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:
- Save your changes.
- 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.