Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Web Tools Guide
Previous Page Home Next Page

annotation support

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, complete the following steps:

  1. In the Java™ EE perspective, click File > New > Other . Select EJB > XDoclet Enterprise JavaBean and click Next.
  2. Select Container Managed Entity Bean and click Next.
  3. Select the Project that will contain the new bean.
  4. In the Folder field, select the folder for the new bean.
  5. In the Java package field, enter the package name for the new bean.
  6. 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.
  7. Optional: Change the Superclass for the bean if you want it to inherit from a class other than java.lang.Object and click Next.
  8. Provide an EJB Name for the bean. This is the name of the enterprise bean class.
  9. Provide a Schema name to specify the abstract schema of the bean.
  10. Provide a Display Name for the bean. This is a short name for the enterprise bean that is used by tools.
  11. Provide a text Description for the bean.
  12. 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.
  13. 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 and do 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 and complete the following steps:
        1. Select a database manager in the Connection Profile Type window and click Next.
        2. Enter a name and description for the new connection definition and click Next.
        3. Select a JDBC driver from the drop-down menu or click the ... button to add, edit, or remove driver definitions.
        4. Specify the other connection details in this window, test the connection, and click Finish and then click Next.
    • Define new attributes specifies that the CMP entity bean attributes will be user-defined. Click Next and complete the following steps:
      1. To specify a table name for the entity bean, enter a name in the Table field.
      2. To create a CMP attribute for the entity bean, click Add.
      3. To specify a name for the attribute, click in the Name field and enter a name.
      4. To specify a type for the attribute, click in the Type field and enter a type.
      5. To make the attribute a key field for the entity bean, select the Primary Key check box.
      6. To add more attributes, repeat procedures b to e and click Next.
  14. Select the type of Modifiers to use for the class.
  15. Optional: Select the Interfaces you want the bean to implement. Click Add to select interfaces that you want to implement and click Remove to take away interfaces that you no longer want to implement.
  16. Select the method stubs that you want the wizard to create.
  17. Click Finish to add the new bean to the specified EJB project.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire