Search in sources :

Example 11 with HibernateJpaVendorAdapter

use of org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter in project tutorials by eugenp.

the class H2TestProfileJPAConfig method entityManagerFactory.

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setDataSource(dataSource());
    em.setPackagesToScan(new String[] { "org.baeldung.domain", "org.baeldung.boot.domain", "org.baeldung.boot.boottest", "org.baeldung.model" });
    em.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
    em.setJpaProperties(additionalProperties());
    return em;
}
Also used : HibernateJpaVendorAdapter(org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)

Example 12 with HibernateJpaVendorAdapter

use of org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter in project tutorials by eugenp.

the class PersistenceConfig method entityManagerFactory.

// beans
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setDataSource(dataSource());
    em.setPackagesToScan(new String[] { "org.baeldung.persistence.model" });
    final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    em.setJpaVendorAdapter(vendorAdapter);
    em.setJpaProperties(additionalProperties());
    return em;
}
Also used : HibernateJpaVendorAdapter(org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)

Example 13 with HibernateJpaVendorAdapter

use of org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter in project irida by phac-nml.

the class IridaApiJdbcDataSourceConfig method jpaVendorAdapter.

@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    adapter.setShowSql(false);
    adapter.setGenerateDdl(true);
    adapter.setDatabase(Database.MYSQL);
    return adapter;
}
Also used : HibernateJpaVendorAdapter(org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter) Bean(org.springframework.context.annotation.Bean)

Example 14 with HibernateJpaVendorAdapter

use of org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter in project irida by phac-nml.

the class IridaApiTestDataSourceConfig method jpaVendorAdapter.

@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    adapter.setShowSql(false);
    adapter.setGenerateDdl(true);
    adapter.setDatabase(Database.H2);
    return adapter;
}
Also used : HibernateJpaVendorAdapter(org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter) Bean(org.springframework.context.annotation.Bean)

Example 15 with HibernateJpaVendorAdapter

use of org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter in project BroadleafCommerce by BroadleafCommerce.

the class BroadleafCommonConfig method blJpaVendorAdapter.

/**
 * Other enterprise/mulititenant modules override this adapter to provide one that supports dynamic filtration
 */
@Bean
@ConditionalOnMissingBean(name = "blJpaVendorAdapter")
public JpaVendorAdapter blJpaVendorAdapter() {
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    // TODO see https://jira.spring.io/browse/SPR-13269. Since we're still on Hibernate 4.1, we want to revert to the previous
    // Spring behavior, which was not to prepare the connection. This avoids some warnings and extra connection acquisitions
    // for read only transactions. When we advance Hibernate, we should look at not blocking Spring's connection preparation.
    vendorAdapter.setPrepareConnection(false);
    return vendorAdapter;
}
Also used : HibernateJpaVendorAdapter(org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

HibernateJpaVendorAdapter (org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter)55 LocalContainerEntityManagerFactoryBean (org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)46 Bean (org.springframework.context.annotation.Bean)45 JpaVendorAdapter (org.springframework.orm.jpa.JpaVendorAdapter)6 Properties (java.util.Properties)5 Database (org.springframework.orm.jpa.vendor.Database)4 HashMap (java.util.HashMap)2 DatabaseManager (com.fredboat.backend.quarterdeck.db.DatabaseManager)1 DataSourceBean (de.alpharogroup.springconfig.DataSourceBean)1 JdbcUrlBean (de.alpharogroup.springconfig.JdbcUrlBean)1 Field (java.lang.reflect.Field)1 HashSet (java.util.HashSet)1 DataSource (javax.sql.DataSource)1 lombok.val (lombok.val)1 HSQLDialect (org.hibernate.dialect.HSQLDialect)1 Test (org.junit.Test)1 Test (org.junit.jupiter.api.Test)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 Primary (org.springframework.context.annotation.Primary)1