Mapping Classes to Tables
The easiest way to translate classes into tables is to make a one-to-one mapping (see Figure 9-2). I strongly recommend against this approach, yet it is done more often than you might realize. One-to-one mapping can lead to the following problems:
Figure 9-2. Remulak class diagram
Too many tables: Most object-to-relational translations done with one-to-one mapping produce more tables than are actually necessary.
Too many joins: If there are too many tables, then logically there will be too many SQL join operations.
Missed tables: Any many-to-many association (e.g., Customer and Address) will require a third relational table ...
Get Developing Applications with Java™ and UML 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.