下面列出了org.hibernate.cfg.Configuration#generateSchemaCreationScript ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Create a schema exporter for the given Configuration
* and given settings
*/
public SchemaExport(Configuration cfg, Settings settings) throws HibernateException {
dialect = settings.getDialect();
connectionHelper = new SuppliedConnectionProviderConnectionHelper(
settings.getConnectionProvider()
);
dropSQL = cfg.generateDropSchemaScript( dialect );
createSQL = cfg.generateSchemaCreationScript( dialect );
format = settings.isFormatSqlEnabled();
}
/**
* Create a schema exporter for the given Configuration, with the given
* database connection properties.
*
* @deprecated properties may be specified via the Configuration object
*/
public SchemaExport(Configuration cfg, Properties properties)
throws HibernateException {
dialect = Dialect.getDialect( properties );
Properties props = new Properties();
props.putAll( dialect.getDefaultProperties() );
props.putAll( properties );
connectionHelper = new ManagedProviderConnectionHelper( props );
dropSQL = cfg.generateDropSchemaScript( dialect );
createSQL = cfg.generateSchemaCreationScript( dialect );
format = PropertiesHelper.getBoolean( Environment.FORMAT_SQL, props );
}
public SchemaExport(Configuration cfg, Connection connection) {
this.connectionHelper = new SuppliedConnectionHelper( connection );
dialect = Dialect.getDialect( cfg.getProperties() );
dropSQL = cfg.generateDropSchemaScript( dialect );
createSQL = cfg.generateSchemaCreationScript( dialect );
}