Creating an EJB 3.0 entity bean

You can use Java™ EE 5 annotations to create an entity bean and add it to your project.

You need to have a Java project or an EJB project created.

To create an entity bean within your EJB project:

  1. In the Java EE perspective, click File > New > Class. The Create a New Java Class wizard opens.
  2. In the Source folder field, select the source folder for the new bean.
  3. In the Package field, type the package name for the new bean.
  4. Click Finish.
  5. In the Java class editor, underneath the package declaration, type @Entity. You can see an error / quick fix icon quick fix icon beside the @Entity line.
  6. Right click the quick fix icon and select Quick Fix. The options to correct the problem display.
  7. Select Import javax.persistence.Entity, press CTRL+S to save, and the dependencies are added to your Java class.