Creating container-managed persistence (CMP) entity beans with XDoclet annotation support

You can use a wizard to create a CMP entity bean and add it to your project.

Before you can create an enterprise bean, you must:

To create a CMP entity bean:

  1. In the J2EE perspective, click File > New > Other > EJB > XDoclet Enterprise JavaBean. The Create an Enterprise JavaBean wizard appears.
  2. Select ContainerManagedEntityBean.
  3. Click Next.
  4. Select the Project that will contain the new bean.
  5. In the Folder field, select the folder for the new bean.
  6. In the Java package field, enter the package name for the new bean.
  7. In the Class name field, type a name for the enterprise bean. By convention, bean names should begin with an uppercase letter.
    Note: You can use Unicode characters for the bean name, but Unicode characters are not supported for enterprise bean packages and classes associated with enterprise beans.
  8. Change the Superclass for the bean if you want it to inherit from a class other than java.lang.Object .
  9. Click Next.
  10. Provide an EJB Name for the bean. This is the name of the enterprise bean class.
  11. Provide a Schema name to specify the abstract schema of the bean.
  12. Provide a Display Name for the bean. This is a short name for the enterprise bean that is used by tools.
  13. Provide a text Description for the bean.
  14. Select a CMP Version for the new bean:
    • 1.x specifies you are adding the bean to an EJB 1.0 or later project.
    • 2.x specifies you are adding the bean to an EJB 2.0 or later project.
  15. Select a Usecase for the new bean:
    • Import attributes from table specifies that the CMP entity bean attributes will be imported from a database table. Click Next.
      1. Perform one of the following:
        • To select an available connection definition, click a connection in the Available Connection Definitions list. Click Next.
        • To create a new JDBC connection definition, click New. In the Connection Parameters window, specify the required JDBC connection parameters on the Connection parameters page of the New Connection wizard. Select a database manager, a JDBC driver, and specify other connection details. To specify JDBC connection filters, clear the Disable filter check box and specify appropriate connection filters. Click Finish.
    • Define new attributes specifies that the CMP entity bean attributes will be user-defined. Click Next.
      1. To create a CMP attribute for the entity bean, click Add.
      2. To specify a name for the attribute, click in the Name field and enter a name.
      3. To specify a type for the attribute, click in the Type field and enter a type.
      4. To make the attribute a key field for the entity bean, select the Primary Key check box.
      5. To specify a table name for the entity bean, enter a name in the Table field.
      6. To add more attributes, repeat procedures a to d.
  16. Click Next.
  17. Select the type of Modifiers to use for the class. Choices are Public, Abstract, and Final.
  18. Select the Interfaces you want the bean to implement:
    • Click the Add button to open the Type Selection dialog box where you can select the interface that you want to implement.
    • If you added an interface that you no longer want to implement, select the interface in the list and click Remove.
  19. Select the method stubs that you want the wizard to create. Choices include main, Inherited abstract methods, and Constructors from the superclass.
  20. Click Finish. The new bean is added to the specified EJB project.