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 -cp hibernate_classpaths org.hibernate.tool.hbm2ddl.SchemaValidator options mapping_files
By the help of the below Table of SchemaValidator Command Line Options is given:
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
|
We can embed SchemaValidator in application as code is given below:
Configuration cfg = ....;
new SchemaValidator(cfg).validate();