public class

SchemaExport

extends Object
java.lang.Object
   ↳ org.hibernate.tool.hbm2ddl.SchemaExport

Class Overview

Commandline tool to export table schema to the database. This class may also be called from inside an application.

Summary

Public Constructors
SchemaExport(Configuration cfg)
Create a schema exporter for the given Configuration
SchemaExport(Configuration cfg, Settings settings)
Create a schema exporter for the given Configuration and given settings
SchemaExport(Configuration cfg, Properties properties)
This constructor is deprecated. properties may be specified via the Configuration object
SchemaExport(Configuration cfg, Connection connection)
Create a schema exporter for the given Configuration, using the supplied connection for connectivity.
Public Methods
void create(boolean script, boolean export)
Run the schema creation script.
void drop(boolean script, boolean export)
Run the drop schema script.
void execute(boolean script, boolean export, boolean justDrop, boolean justCreate)
List getExceptions()
Returns a List of all Exceptions which occured during the export.
static void main(String[] args)
SchemaExport setDelimiter(String delimiter)
Set the end of statement delimiter
SchemaExport setFormat(boolean format)
Should we format the sql strings?
SchemaExport setHaltOnError(boolean haltOnError)
Should we stop once an error occurs?
SchemaExport setImportFile(String filename)
This method is deprecated. use org.hibernate.cfg.Environment.HBM2DDL_IMPORT_FILE
SchemaExport setOutputFile(String filename)
For generating a export script file, this is the file which will be written.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public SchemaExport (Configuration cfg)

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.

public SchemaExport (Configuration cfg, Settings settings)

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.

public SchemaExport (Configuration cfg, Properties properties)

This constructor is deprecated.
properties may be specified via the Configuration object

Create 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.

public SchemaExport (Configuration cfg, Connection connection)

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.

Public Methods

public void create (boolean script, boolean export)

Run the schema creation script.

Parameters
script print the DDL to the console
export export the script to the database

public void drop (boolean script, boolean export)

Run the drop schema script.

Parameters
script print the DDL to the console
export export the script to the database

public void execute (boolean script, boolean export, boolean justDrop, boolean justCreate)

public List getExceptions ()

Returns a List of all Exceptions which occured during the export.

Returns
  • A List containig the Exceptions occured during the export

public static void main (String[] args)

public SchemaExport setDelimiter (String delimiter)

Set the end of statement delimiter

Parameters
delimiter The delimiter
Returns
  • this

public SchemaExport setFormat (boolean format)

Should we format the sql strings?

Parameters
format Should we format SQL strings
Returns
  • this

public SchemaExport setHaltOnError (boolean haltOnError)

Should we stop once an error occurs?

Parameters
haltOnError True if export should stop after error.
Returns
  • this

public SchemaExport setImportFile (String filename)

This method is deprecated.
use org.hibernate.cfg.Environment.HBM2DDL_IMPORT_FILE

An import file, containing raw SQL statements to be executed.

Parameters
filename The import file name.
Returns
  • this

public SchemaExport setOutputFile (String filename)

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