类 SchemaExport
- java.lang.Object
-
- org.hibernate.tool.hbm2ddl.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.- 作者:
- Daniel Bradby, Gavin King, Steve Ebersole
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static classSchemaExport.Actionstatic classSchemaExport.Type
-
构造器概要
构造器 构造器 说明 SchemaExport()
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 static MetadataImplementorbuildMetadataFromMainArgs(String[] args)Intended for test usage only.static TargetDescriptorbuildTargetDescriptor(EnumSet<TargetType> targetTypes, String outputFile, ServiceRegistry serviceRegistry)voidcreate(EnumSet<TargetType> targetTypes, Metadata metadata)voidcreateOnly(EnumSet<TargetType> targetTypes, Metadata metadata)voiddoExecution(SchemaExport.Action action, boolean needsJdbc, Metadata metadata, ServiceRegistry serviceRegistry, TargetDescriptor targetDescriptor)voiddrop(EnumSet<TargetType> targetTypes, Metadata metadata)voidexecute(EnumSet<TargetType> targetTypes, SchemaExport.Action action, Metadata metadata)voidexecute(EnumSet<TargetType> targetTypes, SchemaExport.Action action, Metadata metadata, ServiceRegistry serviceRegistry)static voidexecute(org.hibernate.tool.hbm2ddl.SchemaExport.CommandLineArgs commandLineArgs)ListgetExceptions()Returns a List of all Exceptions which occurred during the export.static voidmain(String[] args)voidperform(SchemaExport.Action action, Metadata metadata, ScriptTargetOutput target)For testing useSchemaExportsetDelimiter(String delimiter)Set the end of statement delimiterSchemaExportsetFormat(boolean format)Should we format the sql strings?SchemaExportsetHaltOnError(boolean haltOnError)Should we stop once an error occurs?SchemaExportsetImportFiles(String importFiles)Comma-separated list of resource names to use for database init commands on create.SchemaExportsetManageNamespaces(boolean manageNamespaces)SchemaExportsetOutputFile(String filename)For generating a export script file, this is the file which will be written.
-
-
-
方法详细资料
-
setOutputFile
public SchemaExport setOutputFile(String filename)
For generating a export script file, this is the file which will be written.- 参数:
filename- The name of the file to which to write the export script.- 返回:
- this
-
setImportFiles
public SchemaExport setImportFiles(String importFiles)
Comma-separated list of resource names to use for database init commands on create.- 参数:
importFiles- The comma-separated list of init file resources names- 返回:
- this
-
setDelimiter
public SchemaExport setDelimiter(String delimiter)
Set the end of statement delimiter- 参数:
delimiter- The delimiter- 返回:
- this
-
setFormat
public SchemaExport setFormat(boolean format)
Should we format the sql strings?- 参数:
format- Should we format SQL strings- 返回:
- this
-
setHaltOnError
public SchemaExport setHaltOnError(boolean haltOnError)
Should we stop once an error occurs?- 参数:
haltOnError- True if export should stop after error.- 返回:
- this
-
setManageNamespaces
public SchemaExport setManageNamespaces(boolean manageNamespaces)
-
drop
public void drop(EnumSet<TargetType> targetTypes, Metadata metadata)
-
create
public void create(EnumSet<TargetType> targetTypes, Metadata metadata)
-
createOnly
public void createOnly(EnumSet<TargetType> targetTypes, Metadata metadata)
-
execute
public void execute(EnumSet<TargetType> targetTypes, SchemaExport.Action action, Metadata metadata)
-
execute
public void execute(EnumSet<TargetType> targetTypes, SchemaExport.Action action, Metadata metadata, ServiceRegistry serviceRegistry)
-
doExecution
public void doExecution(SchemaExport.Action action, boolean needsJdbc, Metadata metadata, ServiceRegistry serviceRegistry, TargetDescriptor targetDescriptor)
-
buildTargetDescriptor
public static TargetDescriptor buildTargetDescriptor(EnumSet<TargetType> targetTypes, String outputFile, ServiceRegistry serviceRegistry)
-
perform
public void perform(SchemaExport.Action action, Metadata metadata, ScriptTargetOutput target)
For testing use
-
main
public static void main(String[] args)
-
execute
public static void execute(org.hibernate.tool.hbm2ddl.SchemaExport.CommandLineArgs commandLineArgs) throws Exception- 抛出:
Exception
-
buildMetadataFromMainArgs
public static MetadataImplementor buildMetadataFromMainArgs(String[] args) throws Exception
Intended for test usage only. Builds a Metadata using the same algorithm asmain(java.lang.String[])- 参数:
args- The "command line args"- 返回:
- The built Metadata
- 抛出:
Exception- Problems building the Metadata
-
getExceptions
public List getExceptions()
Returns a List of all Exceptions which occurred during the export.- 返回:
- A List containing the Exceptions occurred during the export
-
-