Top Description Inners Fields Constructors Methods
org.hibernate.tool.hbm2ddl

public Class SchemaExportTask

extends MatchingTask
Class Inheritance
Imports
java.io.File, .OutputStreamWriter, java.util.LinkedList, .List, org.hibernate.boot.MetadataBuilder, .MetadataSources, org.hibernate.boot.model.naming.ImplicitNamingStrategy, .PhysicalNamingStrategy, org.hibernate.boot.registry.BootstrapServiceRegistry, .BootstrapServiceRegistryBuilder, .StandardServiceRegistryBuilder, org.hibernate.boot.registry.classloading.spi.ClassLoaderService, org.hibernate.boot.registry.internal.StandardServiceRegistryImpl, org.hibernate.boot.spi.MetadataImplementor, org.hibernate.cfg.AvailableSettings, org.hibernate.engine.config.spi.ConfigurationService, org.hibernate.internal.build.AllowSysOut, org.hibernate.internal.log.DeprecationLogger, org.hibernate.internal.util.collections.ArrayHelper, org.hibernate.tool.schema.Action, org.hibernate.tool.schema.spi.DelayedDropRegistryNotAvailableImpl, .SchemaManagementToolCoordinator, org.apache.tools.ant.BuildException, .DirectoryScanner, .Project, org.apache.tools.ant.taskdefs.MatchingTask, org.apache.tools.ant.types.FileSet

An Ant task for SchemaExport.
<taskdef name="schemaexport"
    classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
    classpathref="class.path"/>

<schemaexport
    properties="${build.classes.dir}/hibernate.properties"
    quiet="no"
    text="no"
    drop="no"
    delimiter=";"
    output="${build.dir}/schema-export.sql">
    <fileset dir="${build.classes.dir}">
        <include name="*.hbm.xml"/>
    </fileset>
</schemaexport>
Author
Rong C Ou

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Field Summary

Modifier and TypeField and Description
private File
private boolean
private String
private boolean
private List<FileSet>
private boolean
private String
private File
private String
private File
private boolean
private boolean
Inherited from org.apache.tools.ant.taskdefs.MatchingTask:
fileset

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
private void
public void
execute()

Overrides org.apache.tools.ant.Task.execute.

Execute the task
private String[]
public void
setConfig(File
the path to the resource
configurationFile
)

Set a .cfg.xml file, which will be loaded as a resource, from the classpath

public void
setCreate(boolean
true to enable create mode
create
)

Enable "create" mode.

public void
setDelimiter(String
the delimiter
delimiter
)

Set the end of statement delimiter for the generated script

public void
setDrop(boolean
true to enable drop mode
drop
)

Enable "drop" mode.

public void
setHaltonerror(boolean haltOnError)

public void
setImplicitNamingStrategy(String implicitNamingStrategy)

public void
public void
setOutput(File
the file name
outputFile
)

Set the script output file

public void
setPhysicalNamingStrategy(String physicalNamingStrategy)

public void
setProperties(File
the properties file name
propertiesFile
)

Set a properties file

public void
setQuiet(boolean
true to enable quiet mode
quiet
)

Enable "quiet" mode.

public void
setText(boolean
true to enable text-only mode
text
)

Enable "text-only" mode.

Inherited from org.apache.tools.ant.taskdefs.MatchingTask:
addaddAndaddContainsaddContainsRegexpaddCustomaddDateaddDependaddDepthaddDifferentaddFilenameaddMajorityaddModifiedaddNoneaddNotaddOraddPresentaddSelectoraddSizeaddTypeappendSelectorcreateExcludecreateExcludesFilecreateIncludecreateIncludesFilecreatePatternSetgetDirectoryScannergetImplicitFileSetgetSelectorshasSelectorsselectorCountselectorElementssetCaseSensitivesetDefaultexcludessetExcludessetExcludesfilesetFollowSymlinkssetIncludessetIncludesfilesetProjectXsetIgnoreXsetItems

Field Detail

configurationFileback to summary
private File configurationFile
createback to summary
private boolean create
delimiterback to summary
private String delimiter
dropback to summary
private boolean drop
fileSetsback to summary
private List<FileSet> fileSets
haltOnErrorback to summary
private boolean haltOnError
implicitNamingStrategyback to summary
private String implicitNamingStrategy
outputFileback to summary
private File outputFile
physicalNamingStrategyback to summary
private String physicalNamingStrategy
propertiesFileback to summary
private File propertiesFile
quietback to summary
private boolean quiet
textback to summary
private boolean text

Constructor Detail

SchemaExportTaskback to summary
public SchemaExportTask()

Method Detail

addFilesetback to summary
public void addFileset(FileSet set)
Annotations
@SuppressWarnings:UnusedDeclaration
doExecutionback to summary
private void doExecution() throws Exception
Annotations
@AllowSysOut
executeback to summary
public void execute() throws BuildException

Overrides org.apache.tools.ant.Task.execute.

Execute the task

Annotations
@Override
Exceptions
BuildException:

Doc from org.apache.tools.ant.Task.execute.

if something goes wrong with the build.

getFilesback to summary
private String[] getFiles()
setConfigback to summary
public void setConfig(File configurationFile)

Set a .cfg.xml file, which will be loaded as a resource, from the classpath

Parameters
configurationFile:File

the path to the resource

setCreateback to summary
public void setCreate(boolean create)

Enable "create" mode. Database objects will be created but not first dropped.

Parameters
create:boolean

true to enable create mode

setDelimiterback to summary
public void setDelimiter(String delimiter)

Set the end of statement delimiter for the generated script

Parameters
delimiter:String

the delimiter

Annotations
@SuppressWarnings:UnusedDeclaration
setDropback to summary
public void setDrop(boolean drop)

Enable "drop" mode. Database objects will be dropped but not recreated.

Parameters
drop:boolean

true to enable drop mode

setHaltonerrorback to summary
public void setHaltonerror(boolean haltOnError)
Annotations
@SuppressWarnings:UnusedDeclaration
setImplicitNamingStrategyback to summary
public void setImplicitNamingStrategy(String implicitNamingStrategy)
Annotations
@SuppressWarnings:UnusedDeclaration
setNamingStrategyback to summary
public void setNamingStrategy(String namingStrategy)
Annotations
@Deprecated
setOutputback to summary
public void setOutput(File outputFile)

Set the script output file

Parameters
outputFile:File

the file name

setPhysicalNamingStrategyback to summary
public void setPhysicalNamingStrategy(String physicalNamingStrategy)
Annotations
@SuppressWarnings:UnusedDeclaration
setPropertiesback to summary
public void setProperties(File propertiesFile)

Set a properties file

Parameters
propertiesFile:File

the properties file name

setQuietback to summary
public void setQuiet(boolean quiet)

Enable "quiet" mode. The schema will not be written to standard out.

Parameters
quiet:boolean

true to enable quiet mode

Annotations
@SuppressWarnings:UnusedDeclaration
setTextback to summary
public void setText(boolean text)

Enable "text-only" mode. The schema will not be exported to the database.

Parameters
text:boolean

true to enable text-only mode

org.hibernate.tool.hbm2ddl back to summary

public final Enum SchemaExportTask.ExportType

extends Enum<SchemaExportTask.ExportType>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final Action
public static final SchemaExportTask.ExportType
public static final SchemaExportTask.ExportType
public static final SchemaExportTask.ExportType
public static final SchemaExportTask.ExportType

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
public boolean
public Action
public static SchemaExportTask.ExportType
interpret(boolean justDrop, boolean justCreate)

public static SchemaExportTask.ExportType
public static SchemaExportTask.ExportType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

actionback to summary
private final Action action
BOTHback to summary
public static final SchemaExportTask.ExportType BOTH
CREATEback to summary
public static final SchemaExportTask.ExportType CREATE
DROPback to summary
public static final SchemaExportTask.ExportType DROP
NONEback to summary
public static final SchemaExportTask.ExportType NONE

Constructor Detail

ExportTypeback to summary
private ExportType(Action action)

Method Detail

doCreateback to summary
public boolean doCreate()
doDropback to summary
public boolean doDrop()
getActionback to summary
public Action getAction()
interpretback to summary
public static SchemaExportTask.ExportType interpret(boolean justDrop, boolean justCreate)
valueOfback to summary
public static SchemaExportTask.ExportType valueOf(String name)
valuesback to summary
public static SchemaExportTask.ExportType[] values()