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 run. Because most database schema languages have product features, you need to keep in mind that every option you add to the mapping metadata has the potential to bind to a particular database.
Hibernategive your tables and constraints the automatic creation of basicSchemaIt will even create a sequence based on the primary key generation you choose. But there are someHibernateis not automatically createdSchemafeature. This includes features of all advanced database product features and other physical storage data, such astablespace.In addition, yourDBAwill often add a few extraSchemastatement to improve yourschema. DBAsshould be involved and determined early onHibernateAuto-generatedschema.never allow automatic generation without a checkSchemadeploy to the product.
If your product development steps allow,DBA changes can be fed back into putting your JAVA system, adding mapping metadata. In many projects, mapping metadata can include The necessary schema changes for all DBA modifications . Hibernate can then automatically generate the final schema for all products , including annotations, constraints, indexes, and so on.
In the next section, we show you how to customize the generated schema and how to add free database schema components, we discuss custom data types, additional consistency rules, indexes, and how to replace Hibernate Auto-generated schema.
Export the schema base file to a file
Hibernate binds the org.hibernate.tool.hbm2ddl,schemaexport class to the Main method main (), You can run it from the command line. This helper can be directly with your database session and create A schema or write a text file so that your DBA can perform custom optimization improvements.
Improve database Schema