org.hibernate.cfg.Configuration.generateSchemaUpdateScriptList()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(1.5k)|赞(0)|评价(0)|浏览(102)

本文整理了Java中org.hibernate.cfg.Configuration.generateSchemaUpdateScriptList()方法的一些代码示例,展示了Configuration.generateSchemaUpdateScriptList()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.generateSchemaUpdateScriptList()方法的具体详情如下:
包路径:org.hibernate.cfg.Configuration
类名称:Configuration
方法名:generateSchemaUpdateScriptList

Configuration.generateSchemaUpdateScriptList介绍

暂无

代码示例

代码示例来源:origin: riotfamily/riot

public void execute(Connection connection) throws SQLException {
    Dialect dialect = Dialect.getDialect(getConfiguration()
        .getProperties());
    DatabaseMetadata metadata = new DatabaseMetadata(connection,
        dialect, getConfiguration());
    List<SchemaUpdateScript> schemaUpdates = getConfiguration()
        .generateSchemaUpdateScriptList(dialect, metadata);
    if (schemaUpdates.size() > 0) {
      log.error("The database schema is not up-to-date.\n"
          + "Please execute the following statements:\n"
          + FormatUtils.repeat("-", 80) + "\n"
          + StringUtils.arrayToDelimitedString(
              SchemaUpdateScript
                  .toStringArray(schemaUpdates),
              ";\n") + ";\n"
          + FormatUtils.repeat("-", 80));
      throw new HibernateException("Invalid database schema");
    }
  }
});

代码示例来源:origin: com.github.mg365/mg-common

configuration.setNamingStrategy(new JPAImprovedNamingStrategy());
configuration.buildMappings();
List<SchemaUpdateScript> result = configuration.generateSchemaUpdateScriptList(Dialect.getDialect(configuration.getProperties()), new DatabaseMetadata(con, Dialect.getDialect(configuration.getProperties()), configuration));

相关文章

Configuration类方法