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

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

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

Configuration.setProperty介绍

[英]Set a property value by name
[中]按名称设置属性值

代码示例

代码示例来源:origin: hibernate/hibernate-orm

public static Configuration buildBaseConfiguration() {
  return new Configuration()
      .setProperty( Environment.DRIVER, DRIVER )
      .setProperty( Environment.URL, URL )
      .setProperty( Environment.USER, USER )
      .setProperty( Environment.PASS, PASS )
      .setProperty( Environment.DIALECT, DIALECT.getClass().getName() );
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
public void configure(Configuration cfg) {
  cfg.setProperty(Environment.USE_SECOND_LEVEL_CACHE, "false");
  cfg.setProperty(Environment.GENERATE_STATISTICS, "true");
}

代码示例来源:origin: hibernate/hibernate-orm

public void configure(Configuration cfg) {
  cfg.setProperty( Environment.USE_SECOND_LEVEL_CACHE, "true" );
  cfg.setProperty( Environment.USE_QUERY_CACHE, "true" );
  cfg.setProperty( Environment.GENERATE_STATISTICS, "true" );
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
public void configure(Configuration cfg) {
  cfg.setProperty(
      Environment.HBM2DDL_IMPORT_FILES,
      "/org/hibernate/test/fileimport/humans.sql,/org/hibernate/test/fileimport/dogs.sql"
  );
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
protected void configure(Configuration configuration) {
  configuration.setProperty( Environment.DIALECT, OracleSeqIdGenDialect.class.getName() );
  configuration.setProperty( Environment.USE_NEW_ID_GENERATOR_MAPPINGS, "false" );
  configuration.setProperty( Environment.USE_GET_GENERATED_KEYS, "true" );
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
public void configure(Configuration cfg) {
  cfg.setProperty( Environment.HBM2DDL_IMPORT_FILES, "/org/hibernate/test/fileimport/multi-line-statements.sql" );
  cfg.setProperty(
      Environment.HBM2DDL_IMPORT_FILES_SQL_EXTRACTOR,
      MultipleLinesSqlCommandExtractor.class.getName()
  );
}

代码示例来源:origin: hibernate/hibernate-orm

public void configure(Configuration cfg) {
  super.configure( cfg );
  cfg.setProperty( Environment.USE_QUERY_CACHE, "true" );
  cfg.setProperty( Environment.CACHE_REGION_PREFIX, "foo" );
  cfg.setProperty( Environment.USE_SECOND_LEVEL_CACHE, "true" );
  cfg.setProperty( Environment.GENERATE_STATISTICS, "true" );
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
protected void configure(final Configuration configuration) {
  // enable LL without TX, which used to cause problems when serializing proxies (see HHH-12720)
  configuration.setProperty( AvailableSettings.ENABLE_LAZY_LOAD_NO_TRANS, Boolean.TRUE.toString() );
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
public void configure(Configuration cfg) {
  super.configure( cfg );
  cfg.setProperty( Environment.USE_QUERY_CACHE, "false" );
  cfg.setProperty( Environment.GENERATE_STATISTICS, "true" );
  cfg.setProperty( Environment.QUERY_TRANSLATOR, ASTQueryTranslatorFactory.class.getName() );
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
protected void configure(Configuration configuration) {
  super.configure(configuration);
  configuration.setProperty(AvailableSettings.SHOW_SQL, Boolean.TRUE.toString());
  configuration.setProperty(AvailableSettings.FORMAT_SQL, Boolean.TRUE.toString());
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
protected void configure(Configuration configuration) {
  super.configure( configuration );
  configuration.setProperty( AvailableSettings.SHOW_SQL, Boolean.TRUE.toString() );
  configuration.setProperty( AvailableSettings.FORMAT_SQL, Boolean.TRUE.toString() );
  // configuration.setProperty( AvailableSettings.GENERATE_STATISTICS, "true" );
}

代码示例来源:origin: hibernate/hibernate-orm

public void configure(Configuration cfg) {
  if ( Oracle8iDialect.class.isInstance( getDialect() ) ) {
    cfg.registerTypeOverride( TextAsMaterializedClobType.INSTANCE );
  }
  cfg.setProperty(Environment.USE_SECOND_LEVEL_CACHE, "false");
  cfg.setProperty(Environment.GENERATE_STATISTICS, "true");
  cfg.setProperty(Environment.DEFAULT_BATCH_FETCH_SIZE, "2");
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
protected void configure(Configuration configuration) {
  super.configure( configuration );
  configuration.setProperty( AvailableSettings.GENERATE_STATISTICS, "true" );
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
public void configure(Configuration cfg) {
  super.configure( cfg );
  cfg.setProperty( Environment.CHECK_NULLABILITY, "true" );
}

代码示例来源:origin: hibernate/hibernate-orm

public void configure(Configuration cfg) {
    super.configure( cfg );
    cfg.setProperty(
        "hibernate.event.merge.entity_copy_observer",
        "disallow"
    );
  }
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
public void configure(Configuration cfg) {
  super.configure( cfg );
  cfg.setProperty( Environment.STATEMENT_BATCH_SIZE, "0" ); // problem on HSQLDB (go figure)
}

代码示例来源:origin: hibernate/hibernate-orm

public void configure(Configuration cfg) {
  super.configure( cfg );
  cfg.setProperty(
      "hibernate.event.merge.entity_copy_observer",
      "allow"
  );
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
protected void configure(Configuration configuration) {
  super.configure( configuration );
  configuration.setProperty( AvailableSettings.USE_SECOND_LEVEL_CACHE, "true" );
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
public void configure(Configuration cfg) {
  super.configure( cfg );
  cfg.setProperty( AvailableSettings.KEYWORD_AUTO_QUOTING_ENABLED, "true" );
}

代码示例来源:origin: hibernate/hibernate-orm

private Configuration buildBaseConfiguration() {
    return new Configuration()
        .addResource( "org/hibernate/test/stats/Continent.hbm.xml" )
        .setProperty( AvailableSettings.GENERATE_STATISTICS, "true" );
  }
//

相关文章

Configuration类方法