Migrating IBM Websphere Commerce Version 8 EJB entity beans to Java Persistence API
Enterprise Java Entity Beans are no longer supported in HCL Commerce Version 9. By using a combination of tools and manual steps, you can migrate your EJB 1.1 entity beans to JPA, and update your code to use HCL Commerce Version 9 APIs.
The well-established Java Persistence API (JPA) has numerous advantages, including simplicity and
speed. To take advantage of JPA technology, you can use the Code Migration Tool to help you migrate
existing beans to JPA. The Code Migration Tool scans EJB beans and identifies entities and code that
need to be updated to the JPA specification. Where possible, the tool can perform substitutions,
such as class, exception, and method name changes and removals. Where it is unable to make any
changes, the utility logs what is found.
Note: Stateless Session EJBs are still supported and do not
need to be migrated to JPA.
Before you begin
- WebSphereCommerceServerExtensionsData
- WebSphereCommerceServerExtensionsLogic
- Export the Stores dynamic web project
(WebSphereCommerceServerExtensionsData) as a ZIP archive from your IBM Websphere Commerce Version 8 development environment workspace.
- Open your IBM Websphere Commerce Version 8 development environment workspace, then open the J2EE perspective.
- From the Enterprise Explorer view, right-click the
WebSphereCommerceServerExtensionsData
project, then click . The Export window is displayed. - Expand the General folder, then click .
- Under the WebSphereCommerceServerExtensionsData directory, clear the
WebSphereCommerceServerExtensionsData check box, and select the following
sub-directories:
- ejbModule
- classdiagram.dnx
- Ensure that the Create only selected directories option is selected.
- Click Browse and define a path where the archive file is to be exported.
- Click Finish. A WebSphereCommerceServerExtensionsData.zip archive file is created.
- Copy the exported WebSphereCommerceServerExtensionsData.zip archive file to your HCL Commerce Version 9 development environment so that it can be imported.
- Export the
WebSphereCommerceServerExtensionsLogic
Java project as a Java Archive (JAR) file from your IBM Websphere Commerce Version 8 development environment workspace.- Open your IBM Websphere Commerce Version 8 development environment workspace, then open the J2EE perspective.
- Select the project that contains your customized code. Right-click, then select .
- Click Next.
- In the list of resources under Select the resources to export, ensure that your project is selected.
- Ensure that Export generated class files and resources and Export java source files and resources are selected.
- Click Browse and choose a path to save the exported Java archive file.
- Ensure Compress the contents of the file is selected.
- Click Finish. The
WebSphereCommerceServerExtensionsLogic
Java project is exported as a JAR file.
- Import the Stores dynamic web project
(WebSphereCommerceServerExtensionsData) into your HCL Commerce Version 9
development environment.
- Open your HCL Commerce Version 9 development environment workspace, and then open the Java EE perspective.
- From the Enterprise Explorer view, right-click the
WebSphereCommerceServerExtensionsData
project, then click . The Import window is displayed. - Expand the General folder, then click .
- Click Browse and select the WebSphereCommerceServerExtensionsData.zip archive file that you exported from your IBM Websphere Commerce Version 8 development environment in step 1.
- Click the Overwrite existing resources without warning check box.
- Click Finish. The
WebSphereCommerceServerExtensionsData
project is replaced with the content from your IBM Websphere Commerce Version 8 development environment.
- Import the
WebSphereCommerceServerExtensionsLogic
Java project as a Java Archive (JAR) file into your HCL Commerce Version 9 development environment.- Open your HCL Commerce Version 9 development environment workspace, and then open the Java EE perspective.
- Select .
- Right click the target project and click Import. The Import window is displayed.
- Expand the General folder, then click .
- Click Browse and select the
WebSphereCommerceServerExtensionsLogic.jar
Java archive file that you exported from your IBM Websphere Commerce Version 8 development environment in step 2.Note:- The class path for each custom project must be updated to resolve the dependencies on libraries and between projects.
- Do not import any of the metadata, or your migration will fail. Metadata includes the following
files:
- .setting
- org.eclipse.wst.common.component
- org.eclipse.wst.common.project.facet.core.xml.factorypath
- .project
- .classpath
- META-INF/
- MANIFEST.MF
- .setting
- If you are asked to overwrite any files, click Yes for each file.
- Click Finish. The
WebSphereCommerceServerExtensionsLogic
Java project is replaced with the content from your IBM Websphere Commerce Version 8 development environment.
About this task
The migration of your EJB 1.1 entity beans to JPA involves modifying two projects within your
HCL Commerce Version 9.0.0.1+ development environment:
- WebSphereCommerceServerExtensionsData
- To migrate this project, you can use a combination of tools. You start by leveraging Rational Application Developer (RAD) to generate JPA entities from your database schema. You can then identify and correct any remaining errors that occurred from the JPA generation that is performed by RAD.
- WebSphereCommerceServerExtensionsLogic
- To migrate this project, you can manually convert EJB data beans to JPA data beans, and convert command classes to use JPA code, then use the Code Migration Tool to identify and correct any remaining errors that occurred from the manual conversions.