List of usage examples for javax.persistence SharedCacheMode ENABLE_SELECTIVE
SharedCacheMode ENABLE_SELECTIVE
To view the source code for javax.persistence SharedCacheMode ENABLE_SELECTIVE.
Click Source Link
Cacheable(true)
is specified. From source file:com.devicehive.application.RdbmsPersistenceConfig.java
@Bean @Autowired/* ww w. j a v a 2 s .c o m*/ @DependsOn(value = { "simpleApplicationContextHolder" }) public LocalContainerEntityManagerFactoryBean entityManagerFactory() { final LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean(); factoryBean.setDataSource(dataSource); factoryBean.setSharedCacheMode(SharedCacheMode.ENABLE_SELECTIVE); factoryBean.setValidationMode(ValidationMode.CALLBACK); factoryBean.setJpaVendorAdapter(jpaVendorAdapter); factoryBean.setPackagesToScan("com.devicehive.model"); final Properties props = new Properties(); props.putAll(this.properties.getHibernateProperties(this.dataSource)); factoryBean.setJpaProperties(props); return factoryBean; }
From source file:fr.treeptik.cloudunit.config.DatabaseConfiguration.java
@Bean public EntityManagerFactory entityManagerFactory() { logger.debug("Configuring EntityManager"); LocalContainerEntityManagerFactoryBean lcemfb = new LocalContainerEntityManagerFactoryBean(); lcemfb.setPersistenceProvider(new HibernatePersistence()); lcemfb.setPersistenceUnitName("persistenceUnit"); lcemfb.setDataSource(dataSource());//from w w w . j a v a 2s . c om lcemfb.setJpaDialect(new HibernateJpaDialect()); lcemfb.setJpaVendorAdapter(jpaVendorAdapter()); lcemfb.setSharedCacheMode(SharedCacheMode.ENABLE_SELECTIVE); Properties jpaProperties = new Properties(); jpaProperties.put("hibernate.generate_statistics", true); jpaProperties.put("hibernate.show_sql", Boolean.parseBoolean(databaseShowSQL)); lcemfb.setJpaProperties(jpaProperties); lcemfb.setPackagesToScan("fr.treeptik.cloudunit.model"); lcemfb.afterPropertiesSet(); return lcemfb.getObject(); }
From source file:cn.org.once.cstack.config.DatabaseConfiguration.java
@Bean public EntityManagerFactory entityManagerFactory() { logger.debug("Configuring EntityManager"); LocalContainerEntityManagerFactoryBean lcemfb = new LocalContainerEntityManagerFactoryBean(); lcemfb.setPersistenceProvider(new HibernatePersistenceProvider()); lcemfb.setPersistenceUnitName("persistenceUnit"); lcemfb.setDataSource(dataSource());/*from www. ja v a2s . c om*/ lcemfb.setJpaDialect(new HibernateJpaDialect()); lcemfb.setJpaVendorAdapter(jpaVendorAdapter()); lcemfb.setSharedCacheMode(SharedCacheMode.ENABLE_SELECTIVE); Properties jpaProperties = new Properties(); jpaProperties.put("hibernate.generate_statistics", false); jpaProperties.put("hibernate.show_sql", Boolean.parseBoolean(databaseShowSQL)); lcemfb.setJpaProperties(jpaProperties); lcemfb.setPackagesToScan("cn.org.once.cstack.model"); lcemfb.afterPropertiesSet(); return lcemfb.getObject(); }
From source file:cn.org.once.cstack.config.DatabaseConfigurationTest.java
@Bean public EntityManagerFactory entityManagerFactory() { logger.debug("Configuring EntityManager"); LocalContainerEntityManagerFactoryBean lcemfb = new LocalContainerEntityManagerFactoryBean(); lcemfb.setPersistenceProvider(new HibernatePersistenceProvider()); lcemfb.setPersistenceUnitName("persistenceUnit"); lcemfb.setDataSource(dataSource());/*from w w w .j a v a2 s.c o m*/ lcemfb.setJpaDialect(new HibernateJpaDialect()); lcemfb.setJpaVendorAdapter(jpaVendorAdapter()); lcemfb.setSharedCacheMode(SharedCacheMode.ENABLE_SELECTIVE); Properties jpaProperties = new Properties(); jpaProperties.put("hibernate.generate_statistics", true); jpaProperties.put("hibernate.show_sql", Boolean.parseBoolean(databaseShowSQL)); lcemfb.setJpaProperties(jpaProperties); lcemfb.setPackagesToScan("cn.org.once.cstack.model"); lcemfb.afterPropertiesSet(); return lcemfb.getObject(); }