Package org.hibernate.tool.hbm2ddl
Class SchemaExport
java.lang.Object
org.hibernate.tool.hbm2ddl.SchemaExport
Commandline tool to export table schema to the database. This class may also be called from inside an application.
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a schema exporter for the given ConfigurationSchemaExport(Configuration cfg, Connection connection) Create a schema exporter for the given Configuration, using the supplied connection for connectivity.SchemaExport(Configuration cfg, Properties properties) Deprecated.properties may be specified via the Configuration objectSchemaExport(Configuration cfg, Settings settings) Create a schema exporter for the given Configuration and given settings -
Method Summary
Modifier and TypeMethodDescriptionvoidcreate(boolean script, boolean export) Run the schema creation script.voiddrop(boolean script, boolean export) Run the drop schema script.voidexecute(boolean script, boolean export, boolean justDrop, boolean justCreate) Returns a List of all Exceptions which occured during the export.static voidsetDelimiter(String delimiter) Set the end of statement delimitersetFormat(boolean format) Should we format the sql strings?setHaltOnError(boolean haltOnError) Should we stop once an error occurs?setImportFile(String filename) Deprecated.useinvalid reference
org.hibernate.cfg.Environment.HBM2DDL_IMPORT_FILEsetOutputFile(String filename) For generating a export script file, this is the file which will be written.
-
Constructor Details
-
SchemaExport
Create a schema exporter for the given Configuration- Parameters:
cfg- The configuration from which to build a schema export.- Throws:
HibernateException- Indicates problem preparing for schema export.
-
SchemaExport
Create a schema exporter for the given Configuration and given settings- Parameters:
cfg- The configuration from which to build a schema export.settings- The 'parsed' settings.- Throws:
HibernateException- Indicates problem preparing for schema export.
-
SchemaExport
Deprecated.properties may be specified via the Configuration objectCreate a schema exporter for the given Configuration, with the given database connection properties.- Parameters:
cfg- The configuration from which to build a schema export.properties- The properties from which to configure connectivity etc.- Throws:
HibernateException- Indicates problem preparing for schema export.
-
SchemaExport
Create a schema exporter for the given Configuration, using the supplied connection for connectivity.- Parameters:
cfg- The configuration to use.connection- The JDBC connection to use.- Throws:
HibernateException- Indicates problem preparing for schema export.
-
-
Method Details
-
setOutputFile
For generating a export script file, this is the file which will be written.- Parameters:
filename- The name of the file to which to write the export script.- Returns:
- this
-
setImportFile
Deprecated.useinvalid reference
org.hibernate.cfg.Environment.HBM2DDL_IMPORT_FILEAn import file, containing raw SQL statements to be executed.- Parameters:
filename- The import file name.- Returns:
- this
-
setDelimiter
Set the end of statement delimiter- Parameters:
delimiter- The delimiter- Returns:
- this
-
setFormat
Should we format the sql strings?- Parameters:
format- Should we format SQL strings- Returns:
- this
-
setHaltOnError
Should we stop once an error occurs?- Parameters:
haltOnError- True if export should stop after error.- Returns:
- this
-
create
public void create(boolean script, boolean export) Run the schema creation script.- Parameters:
script- print the DDL to the consoleexport- export the script to the database
-
drop
public void drop(boolean script, boolean export) Run the drop schema script.- Parameters:
script- print the DDL to the consoleexport- export the script to the database
-
execute
public void execute(boolean script, boolean export, boolean justDrop, boolean justCreate) -
main
-
getExceptions
Returns a List of all Exceptions which occured during the export.- Returns:
- A List containig the Exceptions occured during the export
-