4/29/08

SchemaExport

Nutty. Hibernate will generate its own database schema creation scripts.

SchemaExport:


public void doSchema()
{
Configuration hibernateConfig =
new Configuration().configure();

//For SQLServer, e.g.
String dialect = "org.hibernate.dialect.SQLServerDialect";
hibernateConfig.setProperty(Environment.DIALECT,
dialect);
SchemaExport export =
new SchemaExport(hibernateConfig);

export.setOutputFile("outputFileName");
export.setDelimiter("endOfStatementDelimiter");

// Don't print to console
// Don't export to database
export.create(false, false);
}

No comments: