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

public Class SchemaExportTask

extends MatchingTask
Class Inheritance
Imports
org.hibernate.HibernateException, org.hibernate.cfg.Configuration, .NamingStrategy, org.hibernate.util.ArrayHelper, .ReflectHelper, org.apache.tools.ant.BuildException, .DirectoryScanner, .Project, org.apache.tools.ant.taskdefs.MatchingTask, org.apache.tools.ant.types.FileSet, java.io.File, .FileInputStream, .FileNotFoundException, .IOException, java.util.Iterator, .LinkedList, .List, .Properties

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
See Also
SchemaExport

Field Summary

Modifier and TypeField and Description
private File
private boolean
private String
private boolean
private List<E>
private boolean
private String
private File
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
public void
execute()

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

Execute the task
private Configuration
private String[]
private SchemaExport
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
setNamingStrategy(String namingStrategy)

public void
setOutput(File
the file name
outputFile
)

Set the script output file

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<E> fileSets
haltOnErrorback to summary
private boolean haltOnError
namingStrategyback to summary
private String namingStrategy
outputFileback to summary
private File outputFile
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)
executeback to summary
public void execute() throws BuildException

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

Execute the task

Exceptions
BuildException:

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

if something goes wrong with the build.

getConfigurationback to summary
private Configuration getConfiguration() throws Exception
getFilesback to summary
private String[] getFiles()
getSchemaExportback to summary
private SchemaExport getSchemaExport(Configuration cfg) throws HibernateException, IOException
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

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)
setNamingStrategyback to summary
public void setNamingStrategy(String namingStrategy)
setOutputback to summary
public void setOutput(File outputFile)

Set the script output file

Parameters
outputFile:File

the file name

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

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