Generating database tables from entity beans (top-down mapping)
Using the JPA tools, you can generate data definition language (DDL) files for creating database tables from entity beans that you create.
About this task
In top-down mapping, you start with entity beans and use them to create your database tables. You start from scratch with the entity definitions and the object-relational mappings, and then you derive database schemas from that data. If you use this approach, you are most likely concerned with creating the architecture of your object model and then writing your entity classes. These entity classes eventually drive the creation of your database model. If you are using a top-down mapping of the object model to the relational model, develop the entity classes, and then use the JPA tools DDL generation capability to create the database tables that are based on the entity classes.
The process of mapping database tables top-down from entity beans requires these steps:
Procedure
- Create a JPA project or enable JPA support in an appropriate project.
- Create entity beans
- Generate a data definition language (DDL) file using the JPA tools.
- Create a database connection for the JPA project.
- Generate database tables from the DDL file.