20.2.3. Running the Tool
The
SchemaExport
tool writes a DDL script to standard out and/or executes the DDL statements.
The following table displays the
SchemaExport
command line options
java -cp
hibernate_classpathsorg.hibernate.tool.hbm2ddl.SchemaExport
options mapping_files
Option | Description |
---|---|
--quiet | do not output the script to stdout |
--drop | only drop the tables |
--create | only create the tables |
--text | do not export to the database |
--output=my_schema.ddl | output the ddl script to a file |
--naming=eg.MyNamingStrategy | select a NamingStrategy |
--config=hibernate.cfg.xml | read Hibernate configuration from an XML file |
--properties=hibernate.properties | read database properties from a file |
--format | format the generated SQL nicely in the script |
--delimiter=; | set an end of line delimiter for the script |
You can even embed
SchemaExport
in your application:
Configuration cfg = ....; new SchemaExport(cfg).create(false, true);