The OpenEJB Eclipse plugin is able to provide some assistance in helping you migrate EJB 2.x projects to EJB 3.0, by analyzing your ejb-jar.xml file, and adding EJB annotations to your source code. This page will show you how to use this functionality.
First of all you will need to add the EJB 3.0 API jars to the classpath of your project. If you are using Maven, you can add the following to your POM (you will need to update your Eclipse project using mvn eclipse:eclipse afterwards)
<dependencies> ... <dependency> <groupId>org.apache.openejb</groupId> <artifactId>javaee-api</artifactId> <version>5.0-1</version> <scope>provided</scope> </dependency> </dependencies>
Alternatively, import the API jars into your project, and add them to your build path.
Next, click the 'OpenEJB' menu on the menubar, and select 'Generate Annotations'.
Select the project you would like to work with, if it isn't already selected. Click 'Next'.
Select your ejb-jar.xml and (optionally) your openejb-jar.xml files. Select or deselect the other options as appropriate, and select 'Next'.
* Alter SessionBean interfaces - This option makes your session beans
implement your remote / local interfaces as opposed to javax.ejb.SessionBean, and stops your remote / local interfaces extending javax.ejb.EJBObject. * Add @Remote and @RemoteHome annotations - This adds @Remote and @RemoteHome annotations appropriately * Convert entity beans to POJOs - This options converts abstract CMP classes to POJOs generating simple getters and setters.
Review the changes that the plugin will make to your source code. Uncheck any changes you don't want to apply, and click 'Finish'.
All edits are reviewed before going live, so feel free to do much more than fix typos or links. If you see a page that could benefit from an entire rewrite, we'd be thrilled to review it. Don't be surprised if we like it so much we ask you for help with other pages :)NOTICE: unless indicated otherwise on the pages in question, all editable content available from apache.org is presumed to be licensed under the Apache License (AL) version 2.0 and hence all submissions to apache.org treated as formal Contributions under the license terms.