This address: http://blog.csdn.net/sushengmiyan/article/details/50422102
This paper mattered meters along
Hibernate reads The mapping metadata for your Java model class. and generates SCHEMADDL statements. You can export them to a text file, or execute them directly in the database when you inherit the test execution. Because most database schema languages have product features. What you need to keep in mind is every option you add to the mapping metadata has the potential to bind to a specific database.
hibernate give your tables and constraints yourself to create the main schema hibernate don't create it yourself. schema features.
This includes features of all advanced database product features and other physical storage data, such as tablespace. in addition. Your DBA will often add additional schema statements to improve your schema. DBAs should be involved early and determine hibernate 's own active schema. never agree to build yourself without checking. Schema deploy to the product.
Assume that your product development steps agree. DBA The changes you make can be fed back to the JAVA system, add mapping metadata. In many projects, mapping metadata can contain The necessary schema changes for all DBA changes .
Hibernate will then be able to proactively generate the last schema for all products , including gaze, constraint, index, and so on.
In the next section, we show you how to define the generated schema and how to add a free database schema component, and we discuss our own defined data types. Additional consistency rules. Index, and how to replace hibernate 's own schemathat was actively generated.
Export the schema base file to a file
Hibernate binds the org.hibernate.tool.hbm2ddl,schemaexport class to the Main method main (), You can execute from the command line. This helper is capable of directly working with your database session and creating schema or writing a text file so that your DBA can perform its own definition optimization improvements.
Improve database Schema