Entity > Database Export (Create tables)
-
In the Project Management > main-java click on Create tables from JPA entities.
-
Select the desired data source at Persistence Unit.
-
In the following wizard, select the resources folder.
Generate entire database (Create Table)
Perform only individual changes (update)
-
Set a name at DDL File, e.g. Update_CarsDB.ddl.
-
At Options select the option Update Schema.
-
Click Finish.
Use case:
-
Updating an existing database
-
Changes to data model and database during development
-
Delivery of a database update
Execute DDL scripts
-
Set a Connect to a data source.
-
Open the DDL file generated in Project Management > main-resources that you want to run.
-
In the following SQL editor, specify the data source on which you want to execute the DDL script at Type, Name and Database.
-
Right-click in the SQL Editor and select from the context menu > Execute All.
<property name="hibernate.hbm2ddl.auto" value="validate" /> Parameters: * validate - default value. The database schema is only validated. No changes are made to the database itself. * update - The database is updated accordingly based on the changes made to the entities. Only changes and additions are made. * create - The database is completely deployed. Already existing tables and data will be deleted. * create-drop - The database is completely deployed and completely deleted again after the session ends. This strategy is suitable for automated software tests, for example. |