本文整理了Java中org.hibernate.cfg.Configuration.generateSchemaCreationScript()
方法的一些代码示例,展示了Configuration.generateSchemaCreationScript()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.generateSchemaCreationScript()
方法的具体详情如下:
包路径:org.hibernate.cfg.Configuration
类名称:Configuration
方法名:generateSchemaCreationScript
暂无
代码示例来源:origin: Jasig/uPortal
@Override
public void create(boolean export, String outputFile, boolean append) {
final String[] createSQL = configuration.generateSchemaCreationScript(dialect);
perform(createSQL, export, outputFile, append, true);
}
代码示例来源:origin: org.jbpm.jbpm3/jbpm-jpdl
public String[] getCreateSql() {
return configuration.generateSchemaCreationScript(getDialect());
}
代码示例来源:origin: uk.ac.ebi.intact.core/intact-core
/**
* Generates the DDL schema
* @param dialect the dialect to use (complete class name for the hibernate dialect object)
* @return an array containing the SQL statements
*/
public static String[] generateDropSchemaDDL(String dialect) {
Properties props = new Properties();
props.put(Environment.DIALECT, dialect);
Configuration cfg = createConfiguration(props);
String[] sqls = cfg.generateSchemaCreationScript(Dialect.getDialect(props));
addDelimiters(sqls);
return sqls;
}
代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly
/**
* Generates the DDL schema
* @param dialect the dialect to use (complete class name for the hibernate dialect object)
* @return an array containing the SQL statements
*/
public static String[] generateDropSchemaDDL(String dialect) {
Properties props = new Properties();
props.put(Environment.DIALECT, dialect);
Configuration cfg = createConfiguration(props);
String[] sqls = cfg.generateSchemaCreationScript(Dialect.getDialect(props));
addDelimiters(sqls);
return sqls;
}
代码示例来源:origin: uk.ac.ebi.intact.dbupdate/intact-update-model
/**
* Generates the DDL schema
* @param dialect the dialect to use (complete class name for the hibernate dialect object)
* @return an array containing the SQL statements
*/
public static String[] generateCreateSchemaDDL(String dialect) {
Properties props = new Properties();
props.put( Environment.DIALECT, dialect);
Configuration cfg = getBasicConfiguration(props);
String[] sqls = cfg.generateSchemaCreationScript( Dialect.getDialect(props));
addDelimiters(sqls);
return sqls;
}
代码示例来源:origin: uk.ac.ebi.intact.core/intact-core
/**
* Generates the DDL schema
* @param dialect the dialect to use (complete class name for the hibernate dialect object)
* @return an array containing the SQL statements
*/
public static String[] generateCreateSchemaDDL(String dialect) {
Properties props = new Properties();
props.put(Environment.DIALECT, dialect);
Configuration cfg = createConfiguration(props);
String[] sqls = cfg.generateSchemaCreationScript(Dialect.getDialect(props));
addDelimiters(sqls);
return sqls;
}
代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly
/**
* Generates the DDL schema
* @param dialect the dialect to use (complete class name for the hibernate dialect object)
* @return an array containing the SQL statements
*/
public static String[] generateCreateSchemaDDL(String dialect) {
Properties props = new Properties();
props.put(Environment.DIALECT, dialect);
Configuration cfg = createConfiguration(props);
String[] sqls = cfg.generateSchemaCreationScript(Dialect.getDialect(props));
addDelimiters(sqls);
return sqls;
}
代码示例来源:origin: hibernate/hibernate
/**
* Create a schema exporter for the given Configuration, with the given
* database connection properties.
*/
public SchemaExport(Configuration cfg, Properties connectionProperties) throws HibernateException {
dialect = Dialect.getDialect( connectionProperties );
Properties props = new Properties();
props.putAll( dialect.getDefaultProperties() );
props.putAll( connectionProperties );
connectionHelper = new ProviderConnectionHelper( props );
dropSQL = cfg.generateDropSchemaScript( dialect );
createSQL = cfg.generateSchemaCreationScript( dialect );
exceptions = new ArrayList();
}
代码示例来源:origin: hibernate/hibernate
public SchemaExport(Configuration cfg, Connection connection) {
this.connectionHelper = new SuppliedConnectionHelper( connection );
dialect = Dialect.getDialect( cfg.getProperties() );
dropSQL = cfg.generateDropSchemaScript( dialect );
createSQL = cfg.generateSchemaCreationScript( dialect );
exceptions = new ArrayList();
}
代码示例来源:origin: uk.ac.ebi.intact/intact-core
/**
* Generates the DDL schema
* @param dialect the dialect to use (complete class name for the hibernate dialect object)
* @return an array containing the SQL statements
*/
public static String[] generateCreateSchemaDDL(String dialect) {
Configuration cfg = ((AbstractHibernateDataConfig) IntactContext.getCurrentInstance().getConfig().getDefaultDataConfig()).getConfiguration();
Properties props = new Properties();
props.put(Environment.DIALECT, dialect);
return cfg.generateSchemaCreationScript(Dialect.getDialect(props));
}
代码示例来源:origin: apache/servicemix-bundles
@Override
public Object doInHibernate(Session session) throws HibernateException, SQLException {
Connection con = session.connection();
String[] sql = getConfiguration().generateSchemaCreationScript(dialect);
executeSchemaScript(con, sql);
return null;
}
}
代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all
/**
* 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 );
}
代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all
public SchemaExport(Configuration cfg, Connection connection) {
this.connectionHelper = new SuppliedConnectionHelper( connection );
dialect = Dialect.getDialect( cfg.getProperties() );
dropSQL = cfg.generateDropSchemaScript( dialect );
createSQL = cfg.generateSchemaCreationScript( dialect );
}
代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all
/**
* 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();
}
代码示例来源:origin: geowarin/hibernate-examples
public void export(OutputStream out, boolean generateCreateQueries, boolean generateDropQueries) {
Dialect hibDialect = Dialect.getDialect(hibernateConfiguration.getProperties());
try (PrintWriter writer = new PrintWriter(out)) {
if (generateCreateQueries) {
String[] createSQL = hibernateConfiguration.generateSchemaCreationScript(hibDialect);
write(writer, createSQL, FormatStyle.DDL.getFormatter());
}
if (generateDropQueries) {
String[] dropSQL = hibernateConfiguration.generateDropSchemaScript(hibDialect);
write(writer, dropSQL, FormatStyle.DDL.getFormatter());
}
}
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate
/**
* Create a schema exporter for the given Configuration, using the supplied connection for connectivity.
*
* @param configuration The configuration to use.
* @param connection The JDBC connection to use.
* @throws HibernateException Indicates problem preparing for schema export.
*/
public SchemaExport(Configuration configuration, Connection connection) throws HibernateException {
this.connectionHelper = new SuppliedConnectionHelper( connection );
this.sqlStatementLogger = new SqlStatementLogger( false, true );
this.formatter = FormatStyle.DDL.getFormatter();
this.sqlExceptionHelper = new SqlExceptionHelper();
this.importFiles = ConfigurationHelper.getString(
AvailableSettings.HBM2DDL_IMPORT_FILES,
configuration.getProperties(),
DEFAULT_IMPORT_FILE
);
final Dialect dialect = Dialect.getDialect( configuration.getProperties() );
this.dropSQL = configuration.generateDropSchemaScript( dialect );
this.createSQL = configuration.generateSchemaCreationScript( dialect );
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
/**
* Create a schema exporter for the given Configuration, using the supplied connection for connectivity.
*
* @param configuration The configuration to use.
* @param connection The JDBC connection to use.
* @throws HibernateException Indicates problem preparing for schema export.
*/
public SchemaExport(Configuration configuration, Connection connection) throws HibernateException {
this.connectionHelper = new SuppliedConnectionHelper( connection );
this.sqlStatementLogger = new SqlStatementLogger( false, true );
this.formatter = FormatStyle.DDL.getFormatter();
this.sqlExceptionHelper = new SqlExceptionHelper();
this.importFiles = ConfigurationHelper.getString(
AvailableSettings.HBM2DDL_IMPORT_FILES,
configuration.getProperties(),
DEFAULT_IMPORT_FILE
);
final Dialect dialect = Dialect.getDialect( configuration.getProperties() );
this.dropSQL = configuration.generateDropSchemaScript( dialect );
this.createSQL = configuration.generateSchemaCreationScript( dialect );
}
代码示例来源:origin: org.jbpm/pvm
public void apply(Object target, WireContext wireContext) {
Configuration configuration = (Configuration) target;
Properties cfgProperties = configuration.getProperties();
Dialect dialect = Dialect.getDialect(cfgProperties);
ConnectionProvider connectionProvider = ConnectionProviderFactory.newConnectionProvider(cfgProperties);
try {
Connection connection = connectionProvider.getConnection();
try {
log.debug("dropping db schema");
String[] dropScript = configuration.generateDropSchemaScript(dialect);
executeScript(connection, dropScript);
log.debug("creating db schema");
String[] createScript = configuration.generateSchemaCreationScript(dialect);
executeScript(connection, createScript);
}
finally {
connectionProvider.closeConnection(connection);
}
}
catch (SQLException e) {
throw new JDBCException("error creating schema", e);
}
finally {
connectionProvider.close();
}
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
public SchemaExport(ServiceRegistry serviceRegistry, Configuration configuration) {
this.connectionHelper = new SuppliedConnectionProviderConnectionHelper(
serviceRegistry.getService( ConnectionProvider.class )
);
this.sqlStatementLogger = serviceRegistry.getService( JdbcServices.class ).getSqlStatementLogger();
this.formatter = ( sqlStatementLogger.isFormat() ? FormatStyle.DDL : FormatStyle.NONE ).getFormatter();
this.sqlExceptionHelper = serviceRegistry.getService( JdbcServices.class ).getSqlExceptionHelper();
this.importFiles = ConfigurationHelper.getString(
AvailableSettings.HBM2DDL_IMPORT_FILES,
configuration.getProperties(),
DEFAULT_IMPORT_FILE
);
final Dialect dialect = serviceRegistry.getService( JdbcServices.class ).getDialect();
this.dropSQL = configuration.generateDropSchemaScript( dialect );
this.createSQL = configuration.generateSchemaCreationScript( dialect );
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate
public SchemaExport(ServiceRegistry serviceRegistry, Configuration configuration) {
this.connectionHelper = new SuppliedConnectionProviderConnectionHelper(
serviceRegistry.getService( ConnectionProvider.class )
);
this.sqlStatementLogger = serviceRegistry.getService( JdbcServices.class ).getSqlStatementLogger();
this.formatter = ( sqlStatementLogger.isFormat() ? FormatStyle.DDL : FormatStyle.NONE ).getFormatter();
this.sqlExceptionHelper = serviceRegistry.getService( JdbcServices.class ).getSqlExceptionHelper();
this.importFiles = ConfigurationHelper.getString(
AvailableSettings.HBM2DDL_IMPORT_FILES,
configuration.getProperties(),
DEFAULT_IMPORT_FILE
);
final Dialect dialect = serviceRegistry.getService( JdbcServices.class ).getDialect();
this.dropSQL = configuration.generateDropSchemaScript( dialect );
this.createSQL = configuration.generateSchemaCreationScript( dialect );
}
内容来源于网络,如有侵权,请联系作者删除!