Generating CMP Entity Beans from a Database

See Also

In addition to writing CMP entity beans from scratch, you can also generate a set of CMP entity beans for an existing database. You can generate CMP entity beans from an existing database connection or from a database schema.

  1. Make sure that you have access to the database source from which you want to generate the entity beans:
  2. Right-click the EJB module project node in the Projects window and choose New > CMP Entity Beans from Database.
  3. Select the database source:
  4. In the Location drop-down list, select the source root to which you want to add the enterprise beans .
  5. In the Package drop-down list, select an existing package or type a new package name.
  6. Specify whether to generate finder methods for all CMP fields.
  7. Specify whether to add the CMP Fields and CMR fields to the local interfaces.
  8. Click Next.
  9. Select any table from the list on the left and click Add. Then click Finish.

When you generate entity beans from a database, the IDE does the following:

If your project's target server is the Sun Java System Application Server/GlassFish, the IDE also does the following:

See Also
Creating an EJB Module Project
Creating an Enterprise Application Project
About Creating Web Applications
Creating an Enterprise Bean
About EJB 2.1 Entity Beans
Creating a Database Schema

Legal Notices