use of org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter in project gpconnect-demonstrator by nhsconnect.
the class DataSourceConfig method entityManagerFactory.
@Bean
public EntityManagerFactory entityManagerFactory(DataSource dataSource) {
final Database database = Database.valueOf(vendor.toUpperCase());
final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setShowSql(showSql);
vendorAdapter.setGenerateDdl(true);
vendorAdapter.setDatabase(database);
final LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setJpaVendorAdapter(vendorAdapter);
factory.setPackagesToScan("uk.gov.hscic");
factory.setDataSource(dataSource);
factory.afterPropertiesSet();
return factory.getObject();
}
use of org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter in project cas by apereo.
the class Beans method newHibernateJpaVendorAdapter.
/**
* New hibernate jpa vendor adapter.
*
* @param databaseProperties the database properties
* @return the hibernate jpa vendor adapter
*/
public static HibernateJpaVendorAdapter newHibernateJpaVendorAdapter(final DatabaseProperties databaseProperties) {
final HibernateJpaVendorAdapter bean = new HibernateJpaVendorAdapter();
bean.setGenerateDdl(databaseProperties.isGenDdl());
bean.setShowSql(databaseProperties.isShowSql());
return bean;
}
use of org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter in project spring-boot by spring-projects.
the class CustomHibernateJpaAutoConfigurationTests method testDefaultDatabaseForH2.
@Test
public void testDefaultDatabaseForH2() throws Exception {
EnvironmentTestUtils.addEnvironment(this.context, "spring.datasource.url:jdbc:h2:mem:testdb", "spring.datasource.initialize:false");
this.context.register(TestConfiguration.class, DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class, HibernateJpaAutoConfiguration.class);
this.context.refresh();
HibernateJpaVendorAdapter bean = this.context.getBean(HibernateJpaVendorAdapter.class);
Database database = (Database) ReflectionTestUtils.getField(bean, "database");
assertThat(database).isEqualTo(Database.H2);
}
use of org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter in project spring-security by spring-projects.
the class DataConfig method entityManagerFactory.
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setDatabase(Database.HSQL);
vendorAdapter.setGenerateDdl(true);
LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setJpaVendorAdapter(vendorAdapter);
factory.setPackagesToScan(Message.class.getPackage().getName());
factory.setDataSource(dataSource());
return factory;
}
use of org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter in project Activiti by Activiti.
the class DatabaseConfiguration method entityManagerFactory.
@Bean(name = "entityManagerFactory")
public EntityManagerFactory entityManagerFactory() {
LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
entityManagerFactoryBean.setDataSource(dataSource());
entityManagerFactoryBean.setPackagesToScan("org.activiti.rest.api.jpa.model");
entityManagerFactoryBean.setPersistenceUnitName("test");
HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
hibernateJpaVendorAdapter.setShowSql(false);
hibernateJpaVendorAdapter.setGenerateDdl(true);
hibernateJpaVendorAdapter.setDatabase(Database.H2);
entityManagerFactoryBean.setJpaVendorAdapter(hibernateJpaVendorAdapter);
entityManagerFactoryBean.afterPropertiesSet();
return entityManagerFactoryBean.getObject();
}
Aggregations