Mapping enterprise beans to database tables

You can map enterprise bean JAR files (EJB modules) to relational database (RDB) tables using the EJB to RDB Mapping wizard of the Assembly Toolkit. The wizard creates EJB to RDB mappings for the following situations...

Existing enterprise bean but no database schema Top Down mapping generates a default database schema and a mapping from one or more existing enterprise beans.

Existing database schema but no enterprise bean Bottom Up mapping generates one or more enterprise beans and mappings from an existing database schema.

Existing enterprise bean and database schema Meet In the Middle mapping matches existing enterprise beans with existing database tables. You can match by name, by name and type, or by neither.

  1. In the J2EE Hierarchy view, right-click the EJB module.

  2. Click Generate > EJB to RDB Mapping.

  3. After the wizard opens, press F1 and select a type of mapping. The online help provides detailed information on generating a mapping.

  4. For EJB 2.0 projects, on the EJB to RGB Mapping page specify whether you want to create a new backend (Top Down) or use an existing backend (Bottom Up or Meet In the Middle) where the schema exists in the backend but without a mapping file. If you previously generated a mapping, you can create and map unmapped elements or open the mapping editor to manually make changes.In EJB 2.0, your mapping and schema files make up a backend for EJB 2.0 projects. You can have multiple backend folders for each project; for example, one DB2 and one Oracle backend. The wizard uses one database backend only as the default, but you can define as many as you need.

  5. Follow the instructions in the wizard and in the online help.

  6. Click Finish to generate the mapping.


See Also

Assembling applications with the Assembly Toolkit