Mapping examples

In Chapter 11, “Container-managed entity bean development” on page 397, we used an iterative process and meet-in-the-middle mapping between our entity model and the existing tables.

Now let us look at bottom-up and top-down mapping.

Bottom-up mapping from the EJBBANK database

To illustrate the bottom-up process, we create an entity model from the existing tables.

Restriction

Originally we had an address column in the CUSTOMER table and an ADDRESS table that was related to the CUSTOMER table. Bottom-up does not work for such a combination, because the Customer entity bean would have an address CMP attribute and an address CMR relationship.

We renamed the ADDRESS table to CUSTADDRESS to get around this problem.

Create a project ...

Get EJB 2.0 Development with WebSphere Studio Application Developer now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.