org.hibernate.engine.spi.SessionFactoryImplementor.getProperties()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(11.0k)|赞(0)|评价(0)|浏览(157)

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

SessionFactoryImplementor.getProperties介绍

[英]Get a copy of the Properties used to configure this session factory.
[中]获取用于配置此会话工厂的属性的副本。

代码示例

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

@Override
public Map<String, Object> getProperties() {
  return delegate.getProperties();
}

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

@Override
protected StorageAccess createQueryResultsRegionStorageAccess(String regionName,
    SessionFactoryImplementor sessionFactory) {
  RMapCache<Object, Object> mapCache = getCache(regionName, sessionFactory.getProperties(), QUERY_DEF);
  return new RedissonStorage(mapCache, sessionFactory.getProperties(), QUERY_DEF);
}

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

@Override
protected StorageAccess createTimestampsRegionStorageAccess(String regionName,
    SessionFactoryImplementor sessionFactory) {
  RMapCache<Object, Object> mapCache = getCache(regionName, sessionFactory.getProperties(), TIMESTAMPS_DEF);
  return new RedissonStorage(mapCache, sessionFactory.getProperties(), TIMESTAMPS_DEF);
}

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

private void applyEntityManagerSpecificProperties() {
  final Map<String, Object> properties = getFactory().getProperties();
  for ( String key : ENTITY_MANAGER_SPECIFIC_PROPERTIES ) {
    if ( properties.containsKey( key ) ) {
      this.properties.put( key, properties.get( key ) );
    }
  }
}

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

@Override
protected DomainDataStorageAccess createDomainDataStorageAccess(DomainDataRegionConfig regionConfig,
    DomainDataRegionBuildingContext buildingContext) {
  String defaultKey = null;
  if (!regionConfig.getCollectionCaching().isEmpty()) {
    defaultKey = COLLECTION_DEF;
  } else if (!regionConfig.getEntityCaching().isEmpty()) {
    defaultKey = ENTITY_DEF;
  } else if (!regionConfig.getNaturalIdCaching().isEmpty()) {
    defaultKey = NATURAL_ID_DEF;
  } else {
    throw new IllegalArgumentException("Unable to determine entity cache type!");
  }
  
  RMapCache<Object, Object> mapCache = getCache(regionConfig.getRegionName(), buildingContext.getSessionFactory().getProperties(), defaultKey);
  return new RedissonStorage(mapCache, buildingContext.getSessionFactory().getProperties(), defaultKey);
}

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

factory.getProperties()
);
if ( maxParameterMetadataCount == null ) {
  maxParameterMetadataCount = ConfigurationHelper.getInt(
      Environment.QUERY_PLAN_CACHE_MAX_STRONG_REFERENCES,
      factory.getProperties(),
      DEFAULT_PARAMETER_METADATA_MAX_COUNT
  );
    factory.getProperties()
);
if ( maxQueryPlanCount == null ) {
  maxQueryPlanCount = ConfigurationHelper.getInt(
      Environment.QUERY_PLAN_CACHE_MAX_SOFT_REFERENCES,
      factory.getProperties(),
      DEFAULT_QUERY_PLAN_MAX_COUNT
  );

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

/**
   * Get the currently configured JDBC batch size either at the Session-level or SessionFactory-level.
   *
   * If the Session-level JDBC batch size was not configured, return the SessionFactory-level one.
   *
   * @return Session-level or or SessionFactory-level JDBC batch size.
   *
   * @since 5.2
   *
   * @see org.hibernate.boot.spi.SessionFactoryOptions#getJdbcBatchSize
   * @see org.hibernate.boot.SessionFactoryBuilder#applyJdbcBatchSize
   */
  default Integer getConfiguredJdbcBatchSize() {
    final Integer sessionJdbcBatchSize = getJdbcBatchSize();

    return sessionJdbcBatchSize == null ?
      ConfigurationHelper.getInt(
          Environment.STATEMENT_BATCH_SIZE,
          getFactory().getProperties(),
          1
      ) :
      sessionJdbcBatchSize;
  }
}

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

.determineJpaMetaModelPopulationSetting( sessionFactory.getProperties() ) != JpaStaticMetaModelPopulationSetting.DISABLED;

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

public EnabledCaching(SessionFactoryImplementor sessionFactory) {
  this.sessionFactory = sessionFactory;
  this.regionFactory = getSessionFactory().getSessionFactoryOptions().getServiceRegistry().getService( RegionFactory.class );
  this.regionFactory.start( sessionFactory.getSessionFactoryOptions(), sessionFactory.getProperties() );
  if ( getSessionFactory().getSessionFactoryOptions().isQueryCacheEnabled() ) {
    final TimestampsRegion timestampsRegion = regionFactory.buildTimestampsRegion(
        RegionFactory.DEFAULT_UPDATE_TIMESTAMPS_REGION_UNQUALIFIED_NAME,
        sessionFactory
    );
    timestampsCache = sessionFactory.getSessionFactoryOptions()
        .getTimestampsCacheFactory()
        .buildTimestampsCache( this, timestampsRegion );
    legacySecondLevelCacheNames.add( timestampsRegion.getName() );
    final QueryResultsRegion queryResultsRegion = regionFactory.buildQueryResultsRegion(
        RegionFactory.DEFAULT_QUERY_RESULTS_REGION_UNQUALIFIED_NAME,
        sessionFactory
    );
    regionsByName.put( queryResultsRegion.getName(), queryResultsRegion );
    defaultQueryResultsCache = new QueryResultsCacheImpl(
        queryResultsRegion,
        timestampsCache
    );
  }
  else {
    timestampsCache = new TimestampsCacheDisabledImpl();
    defaultQueryResultsCache = null;
  }
}

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

@Override
public Map<String, Object> getProperties() {
  return delegate.getProperties();
}

代码示例来源:origin: com.atlassian.hibernate/hibernate.adapter

/**
 * Get an instance of the HibernateBridge from a SessionFactory.
 */
public static HibernateBridge getHibernateBridge(final org.hibernate.SessionFactory sessionFactory) {
  if (sessionFactory == null)
    return null;
  // the special key=HibernateBridge.class property is set in associate() below
  return (HibernateBridge) ((org.hibernate.engine.spi.SessionFactoryImplementor) sessionFactory)
      .getProperties().get(HibernateBridge.class.getName());
}

代码示例来源:origin: com.atlassian.hibernate/hibernate.adapter

/**
   * Associate the v5 SessionFactory with a HibernateBridge, by adding it as a property.
   * It's nice that the v5 SessionFactory.getProperties is public, because it allows us to
   * avoid using reflection.
   */
  public static org.hibernate.SessionFactory associate(
      final org.hibernate.SessionFactory sessionFactory,
      final HibernateBridge hibernateBridge) {

    ((org.hibernate.engine.spi.SessionFactoryImplementor) sessionFactory).getProperties().put(
        HibernateBridge.class.getName(), hibernateBridge);
    return sessionFactory;
  }
}

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

@Override
public synchronized void register(SessionFactoryImplementor sessionFactory) {
  sessionFactories.add( sessionFactory );
  Object persistenceUnitName = sessionFactory.getProperties().get( AvailableSettings.PERSISTENCE_UNIT_NAME );
  if ( persistenceUnitName instanceof String ) {
    sessionFactoriesByPUName.put( (String) persistenceUnitName, sessionFactory );
  }
  String name = sessionFactory.getName();
  if ( name != null ) {
    sessionFactoriesByName.put( name, sessionFactory );
  }
}

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

private void applyEntityManagerSpecificProperties() {
  final Map<String, Object> properties = getFactory().getProperties();
  for ( String key : ENTITY_MANAGER_SPECIFIC_PROPERTIES ) {
    if ( properties.containsKey( key ) ) {
      this.properties.put( key, properties.get( key ) );
    }
  }
}

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

public QueryPlanCache(SessionFactoryImplementor factory) {
  int maxStrongReferenceCount = ConfigurationHelper.getInt(
      Environment.QUERY_PLAN_CACHE_MAX_STRONG_REFERENCES,
      factory.getProperties(),
      SoftLimitMRUCache.DEFAULT_STRONG_REF_COUNT
  );
  int maxSoftReferenceCount = ConfigurationHelper.getInt(
      Environment.QUERY_PLAN_CACHE_MAX_SOFT_REFERENCES,
      factory.getProperties(),
      SoftLimitMRUCache.DEFAULT_SOFT_REF_COUNT
  );
  this.factory = factory;
  this.sqlParamMetadataCache = new SimpleMRUCache( maxStrongReferenceCount );
  this.planCache = new SoftLimitMRUCache( maxStrongReferenceCount, maxSoftReferenceCount );
}

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

public QueryPlanCache(SessionFactoryImplementor factory) {
  int maxStrongReferenceCount = ConfigurationHelper.getInt(
      Environment.QUERY_PLAN_CACHE_MAX_STRONG_REFERENCES,
      factory.getProperties(),
      SoftLimitMRUCache.DEFAULT_STRONG_REF_COUNT
  );
  int maxSoftReferenceCount = ConfigurationHelper.getInt(
      Environment.QUERY_PLAN_CACHE_MAX_SOFT_REFERENCES,
      factory.getProperties(),
      SoftLimitMRUCache.DEFAULT_SOFT_REF_COUNT
  );
  this.factory = factory;
  this.sqlParamMetadataCache = new SimpleMRUCache( maxStrongReferenceCount );
  this.planCache = new SoftLimitMRUCache( maxStrongReferenceCount, maxSoftReferenceCount );
}

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

public QueryPlanCacheImpl(SessionFactoryImplementor sessionFactory) {
  this.sessionFactory = sessionFactory;
  Integer maxQueryPlanCount = ConfigurationHelper.getInteger(
      Environment.QUERY_PLAN_CACHE_MAX_SIZE,
      sessionFactory.getProperties()
  );
  if ( maxQueryPlanCount == null ) {
    maxQueryPlanCount = ConfigurationHelper.getInt(
        Environment.QUERY_PLAN_CACHE_MAX_SIZE,
        sessionFactory.getProperties(),
        DEFAULT_QUERY_PLAN_MAX_COUNT
    );
  }
  queryPlanCache = new BoundedConcurrentHashMap( maxQueryPlanCount, 20, BoundedConcurrentHashMap.Eviction.LIRS );
  sqmStatementCache = new BoundedConcurrentHashMap( maxQueryPlanCount, 20, BoundedConcurrentHashMap.Eviction.LIRS );
}

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

/**
   * Get the currently configured JDBC batch size either at the Session-level or SessionFactory-level.
   *
   * If the Session-level JDBC batch size was not configured, return the SessionFactory-level one.
   *
   * @return Session-level or or SessionFactory-level JDBC batch size.
   *
   * @since 5.2
   *
   * @see org.hibernate.boot.spi.SessionFactoryOptions#getJdbcBatchSize
   * @see org.hibernate.boot.SessionFactoryBuilder#applyJdbcBatchSize
   */
  default Integer getConfiguredJdbcBatchSize() {
    final Integer sessionJdbcBatchSize = getJdbcBatchSize();

    return sessionJdbcBatchSize == null ?
      ConfigurationHelper.getInt(
          Environment.STATEMENT_BATCH_SIZE,
          getFactory().getProperties(),
          1
      ) :
      sessionJdbcBatchSize;
  }
}

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

@Override
public void initializeSchema(SchemaDefinitionContext context) {
  SessionFactoryImplementor sessionFactoryImplementor = context.getSessionFactory();
  ServiceRegistryImplementor registry = sessionFactoryImplementor.getServiceRegistry();
  DatastoreProvider provider = registry.getService( DatastoreProvider.class );
  List<Sequence> sequences = sequences( context.getDatabase() );
  createSequences( sequences, context.getAllIdSourceKeyMetadata(), provider );
  createIndexesIfMissing( provider, indexSpecs );
  createEntityConstraints( provider, context.getDatabase(), sessionFactoryImplementor.getProperties() );
}

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

public EnabledCaching(SessionFactoryImplementor sessionFactory) {
  this.sessionFactory = sessionFactory;
  this.regionFactory = getSessionFactory().getSessionFactoryOptions().getServiceRegistry().getService( RegionFactory.class );
  this.regionFactory.start( sessionFactory.getSessionFactoryOptions(), sessionFactory.getProperties() );
  if ( getSessionFactory().getSessionFactoryOptions().isQueryCacheEnabled() ) {
    final TimestampsRegion timestampsRegion = regionFactory.buildTimestampsRegion(
        RegionFactory.DEFAULT_UPDATE_TIMESTAMPS_REGION_UNQUALIFIED_NAME,
        sessionFactory
    );
    timestampsCache = sessionFactory.getSessionFactoryOptions()
        .getTimestampsCacheFactory()
        .buildTimestampsCache( this, timestampsRegion );
    legacySecondLevelCacheNames.add( timestampsRegion.getName() );
    final QueryResultsRegion queryResultsRegion = regionFactory.buildQueryResultsRegion(
        RegionFactory.DEFAULT_QUERY_RESULTS_REGION_UNQUALIFIED_NAME,
        sessionFactory
    );
    regionsByName.put( queryResultsRegion.getName(), queryResultsRegion );
    defaultQueryResultsCache = new QueryResultsCacheImpl(
        queryResultsRegion,
        timestampsCache
    );
  }
  else {
    timestampsCache = new TimestampsCacheDisabledImpl();
    defaultQueryResultsCache = null;
  }
}

相关文章

微信公众号

最新文章

更多

SessionFactoryImplementor类方法