Generating database metadata
Roo supports creating JPA entities by introspecting an existing database. If you want Roo to create JPA entities for an existing database, then you may want to know the database metadata used as an input by Roo to create JPA entities corresponding to database tables. In this recipe, we'll look at the database
introspect
command, which lets us view the database metadata in XML format. In the next recipe, Creating entities from a database, we will see how this metadata is used by Roo to create JPA entities.
The following figure shows tables and views of a database that we'll introspect using the database
introspect
commd:
In the given figure, the FLIGHT_TBL
, FLIGHT_DESC_TBL,
and CUSTOMER_TBL
represent database tables, and the FLIGHTS_VIEW
represents a database view. The relationship between the FLIGHT_TBL
and FLIGHT_DESC_TBL
tables is many-to-one. The CUSTOMER_TBL
uses a composite primary key (consisting of the CUST_ID
and CUST_DOB
columns) to uniquely identify a...