此内容没有您所选择的语言版本。
20.2.8. Schema Validation
The
SchemaValidator tool will validate that the existing database schema "matches" your mapping documents. The SchemaValidator depends heavily upon the JDBC metadata API and, as such, will not work with all JDBC drivers. This tool is extremely useful for testing.
java -cphibernate_classpathsorg.hibernate.tool.hbm2ddl.SchemaValidator options mapping_files
The following table displays the
SchemaValidator command line options:
| Option | Description |
|---|---|
--naming=eg.MyNamingStrategy | select a NamingStrategy |
--properties=hibernate.properties | read database properties from a file |
--config=hibernate.cfg.xml | specify a .cfg.xml file |
You can embed
SchemaValidator in your application:
Configuration cfg = ....; new SchemaValidator(cfg).validate();
Configuration cfg = ....;
new SchemaValidator(cfg).validate();