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

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

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

Configuration.addProperties介绍

[英]Add the given properties to ours.
[中]将给定的属性添加到我们的属性中。

代码示例

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

@Override
protected void configure(Configuration configuration) {
  final Properties properties = new Properties();
  properties.put( "hibernate.default_schema", CUSTOM_SCHEMA );
  configuration.addProperties( properties );
}

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

@Override
public void configure(Configuration cfg) {
  super.configure(cfg);
  Properties props = new Properties();
  props.put( Environment.ORDER_INSERTS, "true" );
  props.put( Environment.STATEMENT_BATCH_SIZE, "10" );
  cfg.addProperties( props );
}

代码示例来源:origin: org.hibernate/hibernate-annotations

@Override
public AnnotationConfiguration addProperties(Properties extraProperties) {
  super.addProperties( extraProperties );
  return this;
}

代码示例来源:origin: Impetus/Kundera

Configuration conf = new Configuration().addProperties(puMetadata.getProperties());
String propertyFileName = externalProperties != null ? (String) externalProperties
    .get(PersistenceProperties.KUNDERA_CLIENT_PROPERTY) : null;
    conf.addProperties(props);
    break;

代码示例来源:origin: babyfish-ct/babyfish

@Override
public Configuration addProperties(Properties extraProperties) {
  super.addProperties(extraProperties);
  return this;
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

@Override
public AnnotationConfiguration addProperties(Properties extraProperties) {
  super.addProperties( extraProperties );
  return this;
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

@Override
public AnnotationConfiguration addProperties(Properties extraProperties) {
  super.addProperties( extraProperties );
  return this;
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.ejb

public Ejb3Configuration addProperties(Properties props) {
  cfg.addProperties( props );
  return this;
}

代码示例来源:origin: jpos/jPOS-EE

private void configureProperties(Configuration cfg) throws IOException
{
  String propFile = System.getProperty("DB_PROPERTIES", "cfg/db.properties");
  Properties dbProps = loadProperties(propFile);
  if (dbProps != null)
  {
    cfg.addProperties(dbProps);
  }
}

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

protected Configuration doConfigure(org.dom4j.Document doc) throws HibernateException {
  Element sfNode = doc.getRootElement().element( "session-factory" );
  String name = sfNode.attributeValue( "name" );
  if ( name != null ) properties.setProperty( Environment.SESSION_FACTORY_NAME, name );
  addProperties( sfNode );
  parseSessionFactory( sfNode, name );
  Element secNode = doc.getRootElement().element( "security" );
  if ( secNode != null ) parseSecurity( secNode );
  log.info( "Configured SessionFactory: " + name );
  log.debug( "properties: " + properties );
  return this;
}

代码示例来源:origin: org.jbpm.jbpm3/jbpm-jpdl

public static Configuration getConfiguration(String hibernateCfg, String hibernateProperties) {
 Object key = getKey(hibernateCfg, hibernateProperties);
 Configuration configuration = (Configuration) configurations.get(key);
 if (configuration == null) {
  configuration = new Configuration();
  configuration.configure(hibernateCfg);
  if (hibernateProperties != null) {
   Properties properties = ClassLoaderUtil.getProperties(hibernateProperties);
   configuration.addProperties(properties);
  }
  configurations.put(key, configuration);
 }
 return configuration;
}

代码示例来源:origin: com.github.albfernandez/jbpm-jpdl

public static JbpmHibernateConfiguration getConfiguration(String hibernateCfg, String hibernateProperties) {
 Object key = getKey(hibernateCfg, hibernateProperties);
 JbpmHibernateConfiguration jbpmHibernateConfiguration = configurations.get(key);
 if (jbpmHibernateConfiguration == null) {
  jbpmHibernateConfiguration = new JbpmHibernateConfiguration();
  jbpmHibernateConfiguration.getConfigurationProxy().configure(hibernateCfg);
  if (hibernateProperties != null) {
   Properties properties = ClassLoaderUtil.getProperties(hibernateProperties);
   jbpmHibernateConfiguration.getConfigurationProxy().addProperties(properties);
  }
  configurations.put(key, jbpmHibernateConfiguration);
 }
 return jbpmHibernateConfiguration;
}

代码示例来源:origin: bonitasoft/bonita-engine

protected Configuration buildConfiguration(final Properties properties, final HibernateResourcesConfigurationProvider hibernateResourcesConfigurationProvider) {
  final Configuration configuration = new Configuration();
  configuration.addProperties(properties);
  for (final String resource : hibernateResourcesConfigurationProvider.getResources()) {
    configuration.addResource(resource);
  }
  configuration.buildMappings();
  return configuration;
}

代码示例来源:origin: bonitasoft/bonita-engine

protected Configuration buildConfiguration(final Properties properties, final HibernateResourcesConfigurationProvider hibernateResourcesConfigurationProvider) {
  final Configuration configuration = new Configuration();
  configuration.addProperties(properties);
  for (final String resource : hibernateResourcesConfigurationProvider.getResources()) {
    configuration.addResource(resource);
  }
  configuration.buildMappings();
  return configuration;
}

代码示例来源:origin: dkpro/dkpro-jwpl

private static Configuration getConfiguration(DatabaseConfiguration config) {
    Configuration cfg = new Configuration()
    .addClass(Category.class)
    .addClass(MetaData.class)
    .addClass(Page.class)
    .addClass(PageMapLine.class)
//        .addClass(RelatednessCacheLine.class)
    .addProperties(getProperties(config));
    return cfg;
  }

代码示例来源:origin: org.jbpm/pvm

public void initialize(Object object, WireContext wireContext) {
 Configuration configuration = (Configuration) object;
 apply(mappingOperations, configuration, wireContext);
 apply(cacheOperations, configuration, wireContext);
 if (propertiesDescriptor!=null) {
  Properties properties = (Properties) wireContext.create(propertiesDescriptor, false);
  if (log.isDebugEnabled()) log.debug("adding properties to hibernate configuration: "+properties);
  configuration.addProperties(properties);
 }
 if (schemaOperation != null) {
  schemaOperation.apply(configuration, wireContext);
 }
}

代码示例来源:origin: org.ow2.bonita/bonita-pvm

public void initialize(Object object, WireContext wireContext) {
 Configuration configuration = (Configuration) object;
 apply(mappingOperations, configuration, wireContext);
 apply(cacheOperations, configuration, wireContext);
 if (propertiesDescriptor != null) {
  Properties properties = (Properties) wireContext.create(
    propertiesDescriptor, false);
  if (LOG.isDebugEnabled())
   LOG
     .debug("adding properties to hibernate configuration: "
       + properties);
  configuration.addProperties(properties);
 }
 if (schemaOperation != null) {
  schemaOperation.apply(configuration, wireContext);
 }
}

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

public SessionFactory build() {
    Properties properties = new Properties();
    properties.putAll( TestHelper.getDefaultTestSettings() );
    properties.putAll( customProperties );

    configuration = new OgmConfiguration();
    for ( Class entity : entities ) {
      configuration.addAnnotatedClass( entity );
    }
    configuration.addProperties( properties );
    serviceRegistry = new StandardServiceRegistryBuilder()
        .applySettings( configuration.getProperties() )
        .build();
    return configuration.buildSessionFactory( serviceRegistry );
  }
}

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

private SessionFactory getSessionFactory() {
  Configuration cfg = new Configuration();
  cfg.addAnnotatedClass( Author.class );
  cfg.addAnnotatedClass( Book.class );
  cfg.addProperties( getHibernateProperties() );
  return cfg.buildSessionFactory();
}

代码示例来源:origin: org.infinispan/infinispan-hibernate-cache-commons

public SessionFactory createSessionFactory() {
 Configuration configuration = new Configuration()
    .setProperty(Environment.USE_SECOND_LEVEL_CACHE, "true")
    .setProperty(Environment.USE_QUERY_CACHE, "true")
    .setProperty(Environment.CACHE_REGION_FACTORY, TestRegionFactoryProvider.load().getRegionFactoryClass().getName())
    .setProperty(Environment.DEFAULT_CACHE_CONCURRENCY_STRATEGY, "transactional")
    .setProperty("hibernate.allow_update_outside_transaction", "true") // only applies in 5.2
    .setProperty("javax.persistence.sharedCache.mode", "ALL")
    .setProperty(Environment.HBM2DDL_AUTO, "create-drop");
 Properties testProperties = new Properties();
 testProperties.put(TestRegionFactory.TIME_SERVICE, timeService);
 configuration.addProperties(testProperties);
 configuration.addAnnotatedClass(Person.class);
 return configuration.buildSessionFactory();
}

相关文章

Configuration类方法