Class SchemaExport


  • public class SchemaExport
    extends Object
    Command-line tool for exporting (create and/or drop) a database schema. The export can be sent directly to the database, written to script or both.
    • Constructor Detail

      • SchemaExport

        public SchemaExport()
    • Method Detail

      • setOutputFile

        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
      • setOverrideOutputFileContent

        public SchemaExport setOverrideOutputFileContent()
        For generating a export script file, by default the content will be appended at the begin or end of the file. The sql will be written at the beginning of the file rather append to the end.
        Returns:
        this
      • setImportFiles

        public SchemaExport setImportFiles​(String importFiles)
        Comma-separated list of resource names to use for database init commands on create.
        Parameters:
        importFiles - The comma-separated list of init file resources names
        Returns:
        this
      • setDelimiter

        public SchemaExport setDelimiter​(String delimiter)
        Set the end of statement delimiter
        Parameters:
        delimiter - The delimiter
        Returns:
        this
      • setFormat

        public SchemaExport setFormat​(boolean format)
        Should we format the sql strings?
        Parameters:
        format - Should we format SQL strings
        Returns:
        this
      • setHaltOnError

        public SchemaExport setHaltOnError​(boolean haltOnError)
        Should we stop once an error occurs?
        Parameters:
        haltOnError - True if export should stop after error.
        Returns:
        this
      • setManageNamespaces

        public SchemaExport setManageNamespaces​(boolean manageNamespaces)
      • main

        public static void main​(String[] args)
      • execute

        public static void execute​(org.hibernate.tool.hbm2ddl.SchemaExport.CommandLineArgs commandLineArgs)
                            throws Exception
        Throws:
        Exception
      • buildMetadataFromMainArgs

        public static MetadataImplementor buildMetadataFromMainArgs​(String[] args)
                                                             throws Exception
        Intended for test usage only. Builds a Metadata using the same algorithm as main(java.lang.String[])
        Parameters:
        args - The "command line args"
        Returns:
        The built Metadata
        Throws:
        Exception - Problems building the Metadata
      • getExceptions

        public List getExceptions()
        Returns a List of all Exceptions which occurred during the export.
        Returns:
        A List containing the Exceptions occurred during the export