Improve database schema
Hibernate reads the ing metadata of your java model class and generates schemaDDL statements. You can export them to a text file, or execute them directly in the database when inheriting the test run. Because most database schema languages have product features, you need to keep in mind that every option you add to the ing metadata has the potential to be bound to a specific database.
Hibernate automatically creates a basic schema for your tables and constraints. It even creates a sequence based on the primary key generation method you choose. However, there are some schema Features that hibernate will not automatically create. This includes all advanced database product features and other features related to physical storage data, such as tablespace. in addition, your DBA will often add some additional schema statements to improve your schema. DBAs should be involved in early stage and determine the schema automatically generated by hibernate. you cannot deploy the automatically generated schema to the product without any check.
If your product development steps permit, DBA changes can be fed back to your JAVA System to add ing metadata. In many projects, the ing metadata can include the necessary schema changes for all DBA modifications. Then, hibernate can automatically generate the final schema of all products, including comments, constraints, and indexes.
In the next section, we will show you how to customize the generated schema and how to add free database schema components. We will discuss custom data types, additional consistency rules, indexes, and how to replace the schema automatically generated by hibernate.
Export the schema basic file to a file
Hibernate binds the org. hibernate. tool. hbm2ddl and SchemaExport class to the main () method. You can run the command line. This helper can directly talk to your database and create a schema or write a text file so that your DBA can perform custom optimization and improvement.