企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 20.1.2\. 运行该工具 `SchemaExport`工具把DDL脚本写到标准输出,同时/或者执行DDL语句。 `java -cp` _hibernate_classpaths_ `org.hibernate.tool.hbm2ddl.SchemaExport` _options mapping_files_ **表 20.2\. `SchemaExport`命令行选项** | 选项 | 说明 | | --- | --- | | `--quiet` | 不要把脚本输出到stdout | | `--drop` | 只进行drop tables的步骤 | | `--create` | 只创建表 | | `--text` | 不执行在数据库中运行的步骤 | | `--output=my_schema.ddl` | 把输出的ddl脚本输出到一个文件 | | `--naming=eg.MyNamingStrategy` | 选择一个命名策略(`NamingStrategy`) | | `--config=hibernate.cfg.xml` | 从XML文件读入Hibernate配置 | | `--properties=hibernate.properties` | 从文件读入数据库属性 | | `--format` | 把脚本中的SQL语句对齐和美化 | | `--delimiter=;` | 为脚本设置行结束符 | 你甚至可以在你的应用程序中嵌入`SchemaExport`工具: ``` Configuration cfg = ....; new SchemaExport(cfg).create(false, true); ```