Example usage for org.springframework.orm.jpa.vendor HibernateJpaVendorAdapter setDatabase

List of usage examples for org.springframework.orm.jpa.vendor HibernateJpaVendorAdapter setDatabase

Introduction

In this page you can find the example usage for org.springframework.orm.jpa.vendor HibernateJpaVendorAdapter setDatabase.

Prototype

public void setDatabase(Database database) 

Source Link

Document

Specify the target database to operate on, as a value of the Database enum: DB2, DERBY, H2, HANA, HSQL, INFORMIX, MYSQL, ORACLE, POSTGRESQL, SQL_SERVER, SYBASE

NOTE: This setting will override your JPA provider's default algorithm.

Usage

From source file:br.com.valecard.config.MainConfig.java

@Bean
public EntityManagerFactory entityManagerFactory() {
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setGenerateDdl(true);/*ww w .  j  ava 2 s .com*/
    vendorAdapter.setDatabase(Database.MYSQL);

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan("br.com.valecard.model");
    factory.setDataSource(dataSource());
    factory.afterPropertiesSet();

    return factory.getObject();
}

From source file:com.tchouyangoko.humain.app.config.ConnectionConfig.java

@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    hibernateJpaVendorAdapter.setShowSql(false);
    hibernateJpaVendorAdapter.setGenerateDdl(true);
    hibernateJpaVendorAdapter.setDatabase(Database.DERBY);
    //hibernateJpaVendorAdapter.setDatabase(Database.MYSQL);
    return hibernateJpaVendorAdapter;
}

From source file:com.springsource.html5expense.config.ComponentConfig.java

@Bean
public JpaVendorAdapter jpaAdapter() {
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    hibernateJpaVendorAdapter.setShowSql(true);
    hibernateJpaVendorAdapter.setDatabase(Database.POSTGRESQL);
    hibernateJpaVendorAdapter.setShowSql(true);
    hibernateJpaVendorAdapter.setGenerateDdl(true);
    return hibernateJpaVendorAdapter;
}

From source file:org.unidle.config.DataConfiguration.java

@Bean
@DependsOn({ "cacheManager", "springLiquibase" })
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    final HibernateJpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter();

    jpaVendorAdapter.setDatabase(jpaVendorDatabase);

    final Map<String, Object> jpaProperties = new LinkedHashMap<>();

    jpaProperties.put("hibernate.cache.region.factory_class", hibernateEhcacheRegionFactoryClass);
    jpaProperties.put("hibernate.cache.use_query_cache", hibernateUseQueryCache);
    jpaProperties.put("hibernate.cache.use_second_level_cache", hibernateUseSecondLevelCache);
    jpaProperties.put("hibernate.hbm2ddl.auto", hibernateHbm2ddl);

    final LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();

    entityManagerFactoryBean.setDataSource(dataSource());
    entityManagerFactoryBean.setJpaDialect(new HibernateJpaDialect());
    entityManagerFactoryBean.setJpaVendorAdapter(jpaVendorAdapter);
    entityManagerFactoryBean.setPackagesToScan("org.unidle.domain");
    entityManagerFactoryBean.setJpaPropertyMap(jpaProperties);
    entityManagerFactoryBean.setMappingResources("jpa/orm.xml");

    return entityManagerFactoryBean;
}

From source file:cz.swi2.mendeluis.dataaccesslayer.core.DatabaseConfig.java

@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    hibernateJpaVendorAdapter.setShowSql(true);
    hibernateJpaVendorAdapter.setGenerateDdl(true);
    hibernateJpaVendorAdapter.setDatabase(Database.MYSQL);
    return hibernateJpaVendorAdapter;
}

From source file:com.gondor.config.ApplicationContextConfig.java

@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    adapter.setShowSql(true);/*from   w  w w .ja v  a  2 s.  c om*/
    adapter.setGenerateDdl(true);
    adapter.setDatabase(Database.MYSQL);
    return adapter;
}

From source file:de.alexandria.cms.config.SpringConfigBackendDatabase.java

@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter();
    jpaVendorAdapter.setDatabase(Database.POSTGRESQL);
    jpaVendorAdapter.setShowSql(true);//from w w  w . j a v a  2  s  .c o m
    return jpaVendorAdapter;
}

From source file:org.selfiepro.client.config.MainConfig.java

@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    hibernateJpaVendorAdapter.setShowSql(false);
    hibernateJpaVendorAdapter.setGenerateDdl(true);
    hibernateJpaVendorAdapter.setDatabase(Database.H2);
    return hibernateJpaVendorAdapter;
}

From source file:com.chevrier.legiondao.config.ConfigJpa.java

@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    hibernateJpaVendorAdapter.setShowSql(true);
    hibernateJpaVendorAdapter.setGenerateDdl(true);

    hibernateJpaVendorAdapter.setDatabase(Database.MYSQL);

    //hibernateJpaVendorAdapter.getJpaPropertyMap().put("hibernate.naming-strategy", ConfigJdbc.DEFAULT_NAMING_STRATEGY);
    return hibernateJpaVendorAdapter;
}

From source file:calculus.backend.JpaConfig.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setDatabase(this.dataBase);
    vendorAdapter.setGenerateDdl(true);//www  .j  av  a  2s .c o  m

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan("calculus.backend.model");
    factory.setDataSource(dataSource());
    factory.setJpaProperties(propiedadesAdicionalesJpa());
    return factory;
}