org.springframework.orm.jpa.JpaVendorAdapter Java Examples
The following examples show how to use
org.springframework.orm.jpa.JpaVendorAdapter.
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: JpaTransactionManagerConfiguration.java From hypersistence-optimizer with Apache License 2.0 | 7 votes |
@Bean public EntityManagerFactory entityManagerFactory() { LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); entityManagerFactoryBean.setPersistenceUnitName(persistenceUnitName()); entityManagerFactoryBean.setPersistenceProvider(new HibernatePersistence()); entityManagerFactoryBean.setDataSource(dataSource()); entityManagerFactoryBean.setPackagesToScan(packagesToScan()); JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); entityManagerFactoryBean.setJpaVendorAdapter(vendorAdapter); entityManagerFactoryBean.setJpaProperties(additionalProperties()); entityManagerFactoryBean.afterPropertiesSet(); return HypersistenceHibernatePersistenceProvider.decorate( entityManagerFactoryBean.getNativeEntityManagerFactory() ); }
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: 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 #4
Source File: DaoSpringModuleConfig.java From herd with Apache License 2.0 | 6 votes |
/** * Gets the Hibernate JPA vendor adapter needed by the entity manager. * * @return the Hibernate JPA vendor adapter. */ private JpaVendorAdapter getHibernateJpaVendorAdapter() { HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter(); // Set the database type. String databaseType = configurationHelper.getProperty(ConfigurationValue.DATABASE_TYPE); if (StringUtils.isBlank(databaseType)) { throw new IllegalStateException( String.format("No database type found. Ensure the \"%s\" configuration entry is configured.", ConfigurationValue.DATABASE_TYPE.getKey())); } Database database = Database.valueOf(databaseType); LOGGER.info("jpaTargetDatabase={}", database); hibernateJpaVendorAdapter.setDatabase(database); hibernateJpaVendorAdapter.setGenerateDdl(false); return hibernateJpaVendorAdapter; }
Example #5
Source File: WorkerNodeServiceTest.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.node"); fb.setJpaVendorAdapter(jpaVendorAdapter); return fb; }
Example #6
Source File: JaversSpringJpaApplicationConfig.java From javers with Apache License 2.0 | 5 votes |
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); em.setPackagesToScan("org.javers.spring.model"); JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); em.setJpaVendorAdapter(vendorAdapter); em.setJpaProperties(additionalProperties()); return em; }
Example #7
Source File: PersistenceTransactionalTestConfig.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" }); final JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); em.setJpaVendorAdapter(vendorAdapter); em.setJpaProperties(additionalProperties()); return em; }
Example #8
Source File: DatabaseConfig.java From we-cmdb with Apache License 2.0 | 5 votes |
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource, JpaVendorAdapter jpaVendorAdapter) { LocalContainerEntityManagerFactoryBean emfb = new LocalContainerEntityManagerFactoryBean(); emfb.setDataSource(dataSource); emfb.setJpaVendorAdapter(jpaVendorAdapter); emfb.setPackagesToScan("com.webank.cmdb.domain"); emfb.setJpaPropertyMap(getCustomizedProperties()); return emfb; }
Example #9
Source File: PersistenceJPAConfig.java From tutorials with MIT License | 5 votes |
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); em.setPackagesToScan("com.baeldung.persistence.model"); final JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); em.setJpaVendorAdapter(vendorAdapter); em.setJpaProperties(additionalProperties()); return em; }
Example #10
Source File: PersistenceConfig.java From tutorials with MIT License | 5 votes |
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { final LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean(); emf.setDataSource(restDataSource()); emf.setPackagesToScan(new String[] { "com.baeldung.persistence.model" }); final JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); emf.setJpaVendorAdapter(vendorAdapter); emf.setJpaProperties(hibernateProperties()); return emf; }
Example #11
Source File: DataStoreConfig.java From tutorials with MIT License | 5 votes |
@Bean public JpaVendorAdapter jpaVendorAdapter() { final HibernateJpaVendorAdapter bean = new HibernateJpaVendorAdapter(); bean.setDatabase(Database.H2); bean.setGenerateDdl(true); return bean; }
Example #12
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 #13
Source File: DynamicUpdateConfig.java From tutorials with MIT License | 5 votes |
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); em.setPackagesToScan(new String[] { "com.baeldung.hibernate.dynamicupdate.model" }); JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); em.setJpaVendorAdapter(vendorAdapter); em.setJpaProperties(additionalProperties()); return em; }
Example #14
Source File: PersistenceTestConfig.java From tutorials with MIT License | 5 votes |
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { final LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean(); emf.setDataSource(restDataSource()); emf.setPackagesToScan(new String[] { "com.baeldung.persistence.model" }); final JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); emf.setJpaVendorAdapter(vendorAdapter); emf.setJpaProperties(hibernateProperties()); return emf; }
Example #15
Source File: FileConversionServiceTestConfiguration.java From sakai with Educational Community License v2.0 | 5 votes |
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); em.setPackagesToScan(new String[] { "org.sakaiproject.content.hbm" }); JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); em.setJpaVendorAdapter(vendorAdapter); em.setJpaProperties(hibernateProperties()); return em; }
Example #16
Source File: EngineTest.java From score with Apache License 2.0 | 5 votes |
@Bean(name = "entityManagerFactory") @DependsOn("liquibase") LocalContainerEntityManagerFactoryBean emf(JpaVendorAdapter jpaVendorAdapter, Properties jpaProperties) { LocalContainerEntityManagerFactoryBean fb = new LocalContainerEntityManagerFactoryBean(); fb.setDataSource(dataSource()); fb.setJpaProperties(jpaProperties); fb.setPersistenceProviderClass(HibernatePersistenceProvider.class); fb.setPackagesToScan("io.cloudslang"); fb.setJpaVendorAdapter(jpaVendorAdapter); return fb; }
Example #17
Source File: EngineTest.java From score with Apache License 2.0 | 5 votes |
@Bean JpaVendorAdapter jpaVendorAdapter() { HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter(); adapter.setShowSql(false); adapter.setGenerateDdl(true); return adapter; }
Example #18
Source File: FileConversionServiceTestConfiguration.java From sakai with Educational Community License v2.0 | 5 votes |
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); em.setPackagesToScan(new String[] { "org.sakaiproject.content.hbm" }); JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); em.setJpaVendorAdapter(vendorAdapter); em.setJpaProperties(hibernateProperties()); return em; }
Example #19
Source File: WorkerNodeServiceTest.java From score with Apache License 2.0 | 5 votes |
@Bean JpaVendorAdapter jpaVendorAdapter() { HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter(); adapter.setShowSql(SHOW_SQL); adapter.setGenerateDdl(true); return adapter; }
Example #20
Source File: AbstractFlywayConfiguration.java From high-performance-java-persistence with Apache License 2.0 | 5 votes |
@Bean @DependsOn("flyway") public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean localContainerEntityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); localContainerEntityManagerFactoryBean.setPersistenceUnitName(getClass().getSimpleName()); localContainerEntityManagerFactoryBean.setPersistenceProvider(new HibernatePersistenceProvider()); localContainerEntityManagerFactoryBean.setDataSource(dataSource()); localContainerEntityManagerFactoryBean.setPackagesToScan(packagesToScan()); JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); localContainerEntityManagerFactoryBean.setJpaVendorAdapter(vendorAdapter); localContainerEntityManagerFactoryBean.setJpaProperties(additionalProperties()); return localContainerEntityManagerFactoryBean; }
Example #21
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 #22
Source File: HibernateSearchConfig.java From tutorials with MIT License | 5 votes |
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); em.setPackagesToScan(new String[] { "com.baeldung.hibernatesearch.model" }); JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); em.setJpaVendorAdapter(vendorAdapter); em.setJpaProperties(additionalProperties()); return em; }
Example #23
Source File: VersionRepositoryTest.java From score with Apache License 2.0 | 5 votes |
@Bean JpaVendorAdapter jpaVendorAdapter() { HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter(); adapter.setShowSql(SHOW_SQL); adapter.setGenerateDdl(true); return adapter; }
Example #24
Source File: PartitionTemplateWithEmfTest.java From score with Apache License 2.0 | 5 votes |
@Bean @DependsOn("liquibase") LocalContainerEntityManagerFactoryBean entityManagerFactory(JpaVendorAdapter jpaVendorAdapter) { LocalContainerEntityManagerFactoryBean fb = new LocalContainerEntityManagerFactoryBean(); fb.setDataSource(dataSource()); fb.setPersistenceProviderClass(HibernatePersistenceProvider.class); fb.setPackagesToScan("io.cloudslang.engine.partitions"); fb.setJpaVendorAdapter(jpaVendorAdapter); return fb; }
Example #25
Source File: PersistenceConfig.java From AIDR with GNU Affero General Public License v3.0 | 5 votes |
@Bean public JpaVendorAdapter jpaVendorAdapter() { final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); vendorAdapter.setDatabase(Database.MYSQL); vendorAdapter.setDatabasePlatform(dialect); vendorAdapter.setShowSql(false); vendorAdapter.setGenerateDdl(true); return vendorAdapter; }
Example #26
Source File: ExecutionStateRepositoryTest.java From score with Apache License 2.0 | 5 votes |
@Bean JpaVendorAdapter jpaVendorAdapter() { HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter(); adapter.setShowSql(true); adapter.setGenerateDdl(true); return adapter; }
Example #27
Source File: ExecutionStateRepositoryTest.java From score with Apache License 2.0 | 5 votes |
@Bean(name = "entityManagerFactory") @DependsOn({"liquibase", "dataSource"}) LocalContainerEntityManagerFactoryBean emf(JpaVendorAdapter jpaVendorAdapter) { SimpleHiloIdentifierGenerator.setDataSource(dataSource()); LocalContainerEntityManagerFactoryBean fb = new LocalContainerEntityManagerFactoryBean(); fb.setJpaProperties(hibernateProperties()); fb.setDataSource(dataSource()); fb.setPersistenceProviderClass(HibernatePersistenceProvider.class); fb.setPackagesToScan("io.cloudslang"); fb.setJpaVendorAdapter(jpaVendorAdapter); return fb; }
Example #28
Source File: ReplicationDataSourceApplicationConfig.java From replication-datasource with Apache License 2.0 | 5 votes |
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory(@Qualifier("dataSource") DataSource dataSource) { LocalContainerEntityManagerFactoryBean emfb = new LocalContainerEntityManagerFactoryBean(); emfb.setDataSource(dataSource); emfb.setPersistenceUnitName("replicationTest"); JpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter(); emfb.setJpaVendorAdapter(jpaVendorAdapter); return emfb; }
Example #29
Source File: AbstractJTATransactionManagerConfiguration.java From high-performance-java-persistence with Apache License 2.0 | 5 votes |
@Bean @DependsOn("btmConfig") public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean localContainerEntityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); localContainerEntityManagerFactoryBean.setJtaDataSource(dataSource()); localContainerEntityManagerFactoryBean.setPackagesToScan(packagesToScan()); JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); localContainerEntityManagerFactoryBean.setJpaVendorAdapter(vendorAdapter); localContainerEntityManagerFactoryBean.setJpaProperties(additionalProperties()); return localContainerEntityManagerFactoryBean; }
Example #30
Source File: JpaConfiguration.java From ps-guitar-db with Apache License 2.0 | 5 votes |
@Bean public JpaVendorAdapter jpaVendorAdapter() { HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter(); hibernateJpaVendorAdapter.setShowSql(true); hibernateJpaVendorAdapter.setGenerateDdl(true); hibernateJpaVendorAdapter.setDatabase(Database.H2); return hibernateJpaVendorAdapter; }