Java 类org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory 实例源码

项目:wicket-spring-jpa-bootstrap-boilerplate    文件:PersistenceApplicationConfiguration.java   
Properties additionalProperties() {
    return new Properties() {
        private static final long serialVersionUID = 1L;
        {
            setProperty("hibernate.hbm2ddl.auto", "update");
            setProperty("hibernate.dialect",
                    DerbyTenSevenDialect.class.getName());
            setProperty("hibernate.cache.region.factory_class",
                    SingletonEhCacheRegionFactory.class.getName());
            setProperty("hibernate.cache.use_second_level_cache", "true");
            setProperty("hibernate.cache.use_query_cache", "true");
            setProperty("hibernate.show_sql", "false");
            setProperty("hibernate.format_sql", "false");
        }
    };
}
项目:debop4j    文件:UsingHSqlConfiguration.java   
@Override
public Properties hibernateProperties() {
    Properties props = super.hibernateProperties();

    props.put(Environment.HBM2DDL_AUTO, "create-drop"); // create | spawn | spawn-drop | update | validate | none

    props.put(Environment.USE_SECOND_LEVEL_CACHE, true);
    props.put(Environment.USE_QUERY_CACHE, true);
    props.put(Environment.CACHE_REGION_FACTORY, SingletonEhCacheRegionFactory.class.getName());
    props.put(Environment.CACHE_REGION_PREFIX, "");
    props.put(Environment.CACHE_PROVIDER_CONFIG, "classpath:redis.properties");

    // Validator
    props.put("javax.persistencexml.validation.group.pre-persist", "javax.validation.groups.Default");
    props.put("javax.persistencexml.validation.group.pre-update", "javax.validation.groups.Default");

    return props;
}
项目:debop4j    文件:UsingMySqlConfiguration.java   
@Override
public Properties hibernateProperties() {
    Properties props = super.hibernateProperties();

    props.put(Environment.HBM2DDL_AUTO, "create-drop"); // create | spawn | spawn-drop | update | validate | none

    props.put(Environment.USE_SECOND_LEVEL_CACHE, true);
    props.put(Environment.USE_QUERY_CACHE, true);
    props.put(Environment.CACHE_REGION_FACTORY, SingletonEhCacheRegionFactory.class.getName());
    props.put(Environment.CACHE_REGION_PREFIX, "");
    props.put(Environment.CACHE_PROVIDER_CONFIG, "classpath:redis.properties");

    // Validator
    props.put("javax.persistencexml.validation.group.pre-persist", "javax.validation.groups.Default");
    props.put("javax.persistencexml.validation.group.pre-update", "javax.validation.groups.Default");

    return props;
}
项目:debop4j    文件:UsingMariaDbConfiguration.java   
@Override
public Properties hibernateProperties() {
    Properties props = super.hibernateProperties();

    props.put(Environment.HBM2DDL_AUTO, "create-drop"); // create | spawn | spawn-drop | update | validate | none

    props.put(Environment.USE_SECOND_LEVEL_CACHE, true);
    props.put(Environment.USE_QUERY_CACHE, true);
    props.put(Environment.CACHE_REGION_FACTORY, SingletonEhCacheRegionFactory.class.getName());
    props.put(Environment.CACHE_REGION_PREFIX, "");
    props.put(Environment.CACHE_PROVIDER_CONFIG, "classpath:redis.properties");

    // Validator
    props.put("javax.persistencexml.validation.group.pre-persist", "javax.validation.groups.Default");
    props.put("javax.persistencexml.validation.group.pre-update", "javax.validation.groups.Default");

    return props;
}
项目:debop4j    文件:UsingPostgreSqlConfiguration.java   
@Override
public Properties hibernateProperties() {
    Properties props = super.hibernateProperties();

    props.put(Environment.USE_SECOND_LEVEL_CACHE, true);
    props.put(Environment.USE_QUERY_CACHE, true);
    props.put(Environment.CACHE_REGION_FACTORY, SingletonEhCacheRegionFactory.class.getName());
    props.put(Environment.CACHE_REGION_PREFIX, "");
    props.put(Environment.CACHE_PROVIDER_CONFIG, "classpath:ehcache.xml");

    // Validator
    props.put("javax.persistencexml.validation.group.pre-persist", "javax.validation.groups.Default");
    props.put("javax.persistencexml.validation.group.pre-update", "javax.validation.groups.Default");

    return props;
}
项目:debop4j    文件:DatabaseConfig.java   
@Override
protected Properties hibernateProperties() {

    Properties props = super.hibernateProperties();

    props.put(Environment.HBM2DDL_AUTO, "create-drop"); // create | spawn | spawn-drop | update | validate | none

    props.put(Environment.USE_SECOND_LEVEL_CACHE, true);
    props.put(Environment.USE_QUERY_CACHE, true);
    props.put(Environment.CACHE_REGION_FACTORY, SingletonEhCacheRegionFactory.class.getName());
    props.put(Environment.CACHE_PROVIDER_CONFIG, "classpath:ehcache.xml");

    return props;
}
项目:invesdwin-context-persistence    文件:HibernateDialectSpecificDelegate.java   
@Override
public Map<String, String> getPersistenceProperties(final PersistenceUnitContext context) {
    //        <entry key="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />
    final Map<String, String> props = new HashMap<String, String>();

    //        <prop key="hibernate.dialect">${hibernate.dialect}</prop>
    props.put(AvailableSettings.DIALECT, getHibernateDialect(context).getName());
    //        <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
    props.put(AvailableSettings.HBM2DDL_AUTO, getHibernateHbm2DdlAuto(context));
    //        <!-- Performance settings -->
    //        <prop key="hibernate.bytecode.use_reflection_optimizer">true</prop>
    props.put(AvailableSettings.USE_REFLECTION_OPTIMIZER, String.valueOf(true));
    //        <prop key="hibernate.max_fetch_depth">3</prop>
    props.put(AvailableSettings.MAX_FETCH_DEPTH, String.valueOf(3));
    //        <prop key="hibernate.jdbc.fetch_size">${de.invesdwin.context.persistence.jpa.PersistenceProperties.CONNECTION_BATCH_SIZE}</prop>
    props.put(AvailableSettings.STATEMENT_FETCH_SIZE, String.valueOf(context.getConnectionBatchSize()));
    //        <prop key="hibernate.jdbc.batch_size">${de.invesdwin.context.persistence.jpa.PersistenceProperties.CONNECTION_BATCH_SIZE}</prop>
    props.put(AvailableSettings.STATEMENT_BATCH_SIZE, String.valueOf(context.getConnectionBatchSize()));
    //        <prop key="hibernate.default_batch_fetch_size">${de.invesdwin.context.persistence.jpa.PersistenceProperties.CONNECTION_BATCH_SIZE}</prop>
    props.put(AvailableSettings.DEFAULT_BATCH_FETCH_SIZE, String.valueOf(context.getConnectionBatchSize()));
    //        <prop key="hibernate.jdbc.batch_versioned_data">true</prop>
    props.put(AvailableSettings.BATCH_VERSIONED_DATA, String.valueOf(true));
    //        <prop key="hibernate.order_inserts">true</prop>
    props.put(AvailableSettings.ORDER_INSERTS, String.valueOf(true));
    //        <prop key="hibernate.order_updates">true</prop>
    props.put(AvailableSettings.ORDER_UPDATES, String.valueOf(true));
    //        <prop key="hibernate.cache.use_second_level_cache">true</prop>
    props.put(AvailableSettings.USE_SECOND_LEVEL_CACHE, String.valueOf(true));
    //        <prop key="hibernate.cache.use_query_cache">true</prop>
    props.put(AvailableSettings.USE_QUERY_CACHE, String.valueOf(true));
    //        <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory</prop>
    props.put(AvailableSettings.CACHE_REGION_FACTORY, SingletonEhCacheRegionFactory.class.getName());
    //        <prop key="net.sf.ehcache.configurationResourceName">#{ehCacheConfigurationMerger.newEhCacheXml().toString()}</prop>
    final EhCacheConfigurationMerger ehCacheConfigurationMerger = MergedContext.getInstance()
            .getBean(EhCacheConfigurationMerger.class);
    props.put(SingletonEhCacheRegionFactory.NET_SF_EHCACHE_CONFIGURATION_RESOURCE_NAME,
            ehCacheConfigurationMerger.newEhCacheXml().toString());
    props.put(AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, String.valueOf(true));
    props.put(AvailableSettings.PREFER_POOLED_VALUES_LO, String.valueOf(true));
    return props;
}