SchemaExport工具把DDL脚本写到标准输出,同时/或者执行DDL语句。
SchemaExport
java -cp hibernate_classpaths org.hibernate.tool.hbm2ddl.SchemaExport options mapping_files
java -cp
org.hibernate.tool.hbm2ddl.SchemaExport
表 20.2. SchemaExport命令行选项
--quiet
--drop
--create
--text
--output=my_schema.ddl
--naming=eg.MyNamingStrategy
NamingStrategy
--config=hibernate.cfg.xml
--properties=hibernate.properties
--format
--delimiter=;
你甚至可以在你的应用程序中嵌入SchemaExport工具:
Configuration cfg = ....; new SchemaExport(cfg).create(false, true);