Generate a bottom-up mapping

 

+
Search Tips   |   Advanced Search

 

You can use the bottom-up mapping approach to generate CMP enterprise beans and mappings from an existing database schema.

You can use the EJB mapping wizard in the EJB tools and use the following development approaches for mapping enterprise beans to database tables. If you already have entity beans in a project, the mapping gives unique names to generated beans to avoid collision of new table mappings to existing CMP entity beans. By default, relationships are generated where foreign-keys exist.

Backends folder

This product supports multiple backends that make multiple deployments inside a single EJB module configurable at runtime. Bottom-up mapping only supports a single backend. A backend can represent different database vendors, or simply alternative mappings and table qualifiers. If multiple backends exist, then the current BackendID needs to be set in the EJB deployment descriptor editor (when working with EJB 2.x beans). This mapping/deployment will be used at runtime when the JAR is installed on WebSphere Application Server. When deploying EJB 1.1 beans inside an EJB 2.x project, the EJB 1.1 beans are deployed only once, using the first declared database and type.

Note: When you do a bottom-up mapping, by default the wizard does not generate beans for underlying tables for views. However, because relationships need to be created for foreign keys, the wizard automatically creates a bean for any table that has any foreign keys or whose primary key is pointed to by any foreign keys from other tables. If you clear the Do not generate beans for tables included in views check box, the wizard generates beans for all tables and views in the database schemata.

To generate enterprise beans and map based on a bottom-up mapping you have the following options:

Generating a bottom-up mapping for the first time
This task describes how to generate for your first time a bottom-up mapping. Bottom-up approach assumes that the database tables already exist, and that once the selected tables are imported, the enterprise beans and mappings between them are automatically generated. By default, relationships are generated where foreign-keys exist.

Generating a bottom-up mapping using an existing EJB project
This task describes how to generate a bottom-up mapping when you want to use an EJB project that already exists on your workspace.

Generating a bottom-up mapping using an existing database
This task describes how to generate a bottom-up mapping when you want to create EJBs from tables in an existing database connection or database view.

Feedback