Java Code Examples for org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean#setJpaProperties()
The following examples show how to use
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean#setJpaProperties() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DatabaseConfiguration.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Bean public EntityManagerFactory entityManagerFactory() { log.debug("Configuring EntityManager"); LocalContainerEntityManagerFactoryBean lcemfb = new LocalContainerEntityManagerFactoryBean(); lcemfb.setPersistenceProvider(new HibernatePersistence()); lcemfb.setPersistenceUnitName("persistenceUnit"); lcemfb.setDataSource(dataSource()); lcemfb.setJpaDialect(new HibernateJpaDialect()); lcemfb.setJpaVendorAdapter(jpaVendorAdapter()); Properties jpaProperties = new Properties(); jpaProperties.put("hibernate.cache.use_second_level_cache", false); jpaProperties.put("hibernate.generate_statistics", env.getProperty("hibernate.generate_statistics", Boolean.class, false)); lcemfb.setJpaProperties(jpaProperties); lcemfb.setPackagesToScan("com.activiti.domain"); lcemfb.afterPropertiesSet(); return lcemfb.getObject(); }
Example 2
Source File: AppConfig.java From Spring-Framework-Essentials with MIT License | 6 votes |
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory( DataSource dataSource, JpaVendorAdapter jpaVendorAdapter) { Properties props = new Properties(); props.setProperty("hibernate.format_sql", String.valueOf(true)); LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean(); emf.setDataSource(dataSource); emf.setPackagesToScan("com.oreilly.entities"); emf.setJpaVendorAdapter(jpaVendorAdapter); emf.setJpaProperties(props); return emf; }
Example 3
Source File: JpaConfig.java From spring4-sandbox with Apache License 2.0 | 5 votes |
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean(); emf.setDataSource(dataSource()); emf.setPackagesToScan("com.hantsylabs.example.spring.model"); emf.setPersistenceProvider(new HibernatePersistenceProvider()); emf.setJpaProperties(jpaProperties()); return emf; }
Example 4
Source File: JPATransactionManagerConfiguration.java From high-performance-java-persistence with Apache License 2.0 | 5 votes |
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); entityManagerFactoryBean.setPersistenceUnitName(getClass().getSimpleName()); entityManagerFactoryBean.setPersistenceProvider(new HibernatePersistenceProvider()); entityManagerFactoryBean.setDataSource(dataSource()); entityManagerFactoryBean.setPackagesToScan(packagesToScan()); JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); entityManagerFactoryBean.setJpaVendorAdapter(vendorAdapter); entityManagerFactoryBean.setJpaProperties(additionalProperties()); return entityManagerFactoryBean; }
Example 5
Source File: PersistenceConfig.java From tutorials with MIT License | 5 votes |
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); em.setPackagesToScan(new String[] { "com.baeldung.persistence.model", "com.baeldung.springpagination.model" }); final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); // vendorAdapter.set em.setJpaVendorAdapter(vendorAdapter); em.setJpaProperties(additionalProperties()); return em; }
Example 6
Source File: VersionRepositoryTest.java From score with Apache License 2.0 | 5 votes |
@Bean(name = "entityManagerFactory") @DependsOn("liquibase") LocalContainerEntityManagerFactoryBean emf(JpaVendorAdapter jpaVendorAdapter) { LocalContainerEntityManagerFactoryBean fb = new LocalContainerEntityManagerFactoryBean(); fb.setJpaProperties(hibernateProperties()); fb.setDataSource(dataSource()); fb.setPersistenceProviderClass(HibernatePersistenceProvider.class); fb.setPackagesToScan("io.cloudslang.engine.versioning"); fb.setJpaVendorAdapter(jpaVendorAdapter); return fb; }
Example 7
Source File: DbConfig.java From tutorials with MIT License | 5 votes |
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); em.setPackagesToScan(new String[] { "com.baeldung.books.models" }); em.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); em.setJpaProperties(additionalProperties()); return em; }
Example 8
Source File: H2JpaConfig.java From tutorials with MIT License | 5 votes |
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); em.setPackagesToScan(new String[] { "com.baeldung.boot.domain" }); em.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); em.setJpaProperties(additionalProperties()); return em; }
Example 9
Source File: JpaConfig.java From spring4-sandbox with Apache License 2.0 | 5 votes |
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean(); emf.setDataSource(dataSource()); emf.setPackagesToScan("com.hantsylabs.example.spring.model"); emf.setPersistenceProvider(new HibernatePersistenceProvider()); emf.setJpaProperties(jpaProperties()); return emf; }
Example 10
Source File: MySQLAutoconfiguration.java From tutorials with MIT License | 5 votes |
@Bean @ConditionalOnBean(name = "dataSource") LocalContainerEntityManagerFactoryBean entityManagerFactory() throws IOException { final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); em.setPackagesToScan(new String[] { "com.baeldung.persistence.model" }); final JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); em.setJpaVendorAdapter(vendorAdapter); em.setJpaProperties(additionalProperties()); return em; }
Example 11
Source File: MySQLAutoconfiguration.java From tutorials with MIT License | 5 votes |
@Bean @ConditionalOnBean(name = "dataSource") @ConditionalOnMissingBean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); em.setPackagesToScan("com.baeldung.autoconfiguration.example"); em.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); if (additionalProperties() != null) { em.setJpaProperties(additionalProperties()); } return em; }
Example 12
Source File: ResourceLocalReleaseAfterStatementConfiguration.java From high-performance-java-persistence with Apache License 2.0 | 5 votes |
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); entityManagerFactoryBean.setPersistenceUnitName(getClass().getSimpleName()); entityManagerFactoryBean.setPersistenceProvider(new HibernatePersistenceProvider()); entityManagerFactoryBean.setDataSource(dataSource()); entityManagerFactoryBean.setPackagesToScan(packagesToScan()); JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); entityManagerFactoryBean.setJpaVendorAdapter(vendorAdapter); entityManagerFactoryBean.setJpaProperties(additionalProperties()); return entityManagerFactoryBean; }
Example 13
Source File: JpaConfig.java From spring4-sandbox with Apache License 2.0 | 5 votes |
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean(); emf.setDataSource(dataSource()); emf.setPackagesToScan("com.hantsylabs.example.spring.model"); emf.setPersistenceProvider(new HibernatePersistenceProvider()); emf.setJpaProperties(jpaProperties()); return emf; }
Example 14
Source File: SpringWebConfig.java From spring-mvc-react with MIT License | 5 votes |
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); entityManagerFactoryBean.setDataSource(dataSource()); entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistence.class); entityManagerFactoryBean.setPackagesToScan(env.getRequiredProperty(PROP_ENTITYMANAGER_PACKAGES_TO_SCAN)); entityManagerFactoryBean.setJpaProperties(getHibernateProperties()); return entityManagerFactoryBean; }
Example 15
Source File: JpaConfiguration.java From atsea-sample-shop-app with Apache License 2.0 | 5 votes |
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() throws NamingException { LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean(); factoryBean.setDataSource(dataSource()); factoryBean.setPackagesToScan(new String[] { "com.docker.atsea.model" }); factoryBean.setJpaVendorAdapter(jpaVendorAdapter()); factoryBean.setJpaProperties(jpaProperties()); return factoryBean; }
Example 16
Source File: PersistenceConfig.java From Spring with Apache License 2.0 | 5 votes |
@Bean public EntityManagerFactory entityManagerFactory(){ final LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean(); factoryBean.setPersistenceUnitManager(persistenceUnitManager()); factoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); factoryBean.setJpaProperties(dataConfig.hibernateProperties()); factoryBean.afterPropertiesSet(); factoryBean.setLoadTimeWeaver(new InstrumentationLoadTimeWeaver()); return factoryBean.getNativeEntityManagerFactory(); }
Example 17
Source File: JpaTestConfig.java From crnk-framework with Apache License 2.0 | 5 votes |
@Bean public LocalContainerEntityManagerFactoryBean getLocalContainerEntityManagerFactoryBean() { LocalContainerEntityManagerFactoryBean bean = new LocalContainerEntityManagerFactoryBean(); bean.setJpaProperties(hibernateProperties()); bean.setPackagesToScan(TestEntity.class.getPackage().getName()); bean.setDataSource(testDataSource()); bean.setPersistenceUnitName("TEST"); return bean; }
Example 18
Source File: JpaConfig.java From spring4-sandbox with Apache License 2.0 | 5 votes |
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean(); emf.setDataSource(dataSource()); emf.setPackagesToScan("com.hantsylabs.example.spring.model"); emf.setPersistenceProvider(new HibernatePersistenceProvider()); emf.setJpaProperties(jpaProperties()); emf.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); return emf; }
Example 19
Source File: JpaConfig.java From spring4-sandbox with Apache License 2.0 | 5 votes |
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean(); emf.setDataSource(dataSource()); emf.setPackagesToScan("com.hantsylabs.example.spring.model"); emf.setPersistenceProvider(new HibernatePersistenceProvider()); emf.setJpaProperties(jpaProperties()); return emf; }
Example 20
Source File: JpaConfig.java From spring4-sandbox with Apache License 2.0 | 5 votes |
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean(); emf.setDataSource(dataSource()); emf.setPackagesToScan("com.hantsylabs.example.spring.model"); emf.setPersistenceProvider(new HibernatePersistenceProvider()); emf.setJpaProperties(jpaProperties()); return emf; }