EclipseLink can be used to automatically generate the tables and database schema for a persistence unit. This is done through the
"eclipselink.ddl-generation" persistence unit property, set to either
"drop-and-create-tables". The tables and constraints will be generated for all of the classes defined in that persistence unit.
"create-tables" - will only attempt to create tables, if the table already exists then it will not be dropped or replaced, the existing table will be used.
"drop-and-create-tables" - will first drop the existing table, and then create the new table. This is useful in development when the schema is frequently changing, or for testing when the existing data needs to be cleared. Note that this will loose all of the data in the tables when they are dropped, so never use this on a production schema that has valuable data in the database. If the schema changed dramatically, there could be old constraints in the database that prevent the dropping of the old tables. This may require the old schema to be dropped through another mechanism.