Search in sources :

Example 26 with HibernateJpaVendorAdapter

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

the class JpaBeans 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;
}
Also used : HibernateJpaVendorAdapter(org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter)

Example 27 with HibernateJpaVendorAdapter

use of org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter in project av-service by dvoraka.

the class DbConfig method entityManagerFactory.

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource) {
    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(dataSource);
    entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
    entityManagerFactoryBean.setPackagesToScan("dvoraka.avservice.db.model");
    entityManagerFactoryBean.setJpaProperties(hibernateProperties());
    return entityManagerFactoryBean;
}
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 28 with HibernateJpaVendorAdapter

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

the class Configurations method entityManagerFactory.

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(dataSource());
    entityManagerFactoryBean.setPackagesToScan("com.rdbcache.models");
    entityManagerFactoryBean.setJpaProperties(buildHibernateProperties());
    entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter() {

        {
            setDatabase(Database.H2);
        }
    });
    return entityManagerFactoryBean;
}
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 29 with HibernateJpaVendorAdapter

use of org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter in project nikita-noark5-core by HiOA-ABI.

the class DataSourceConfig method entityManagerFactory.

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setDataSource(dataSource());
    // Scan the Noark domain model from core-common and application domain model
    em.setPackagesToScan("nikita.model", "no.arkivlab.hioa.nikita.webapp.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 30 with HibernateJpaVendorAdapter

use of org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter in project bundle-app-ui by astrapi69.

the class PersistenceJPAConfig method entityManagerFactory.

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    // final LocalContainerEntityManagerFactoryBean em = SpringJpaFactory
    // .newEntityManagerFactoryBean("bundlemanagement", dataSource(),
    // SpringJpaFactory.newJpaVendorAdapter(Database.H2), jpaProperties());
    LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setPersistenceUnitName("bundlemanagement");
    em.setDataSource(dataSource());
    em.setPackagesToScan(new String[] { "de.alpharogroup.db.resource.bundles.*", "de.alpharogroup.db.resource.bundles.*.*", "de.alpharogroup.address.book.*", "de.alpharogroup.address.book.*.*", "de.alpharogroup.resource.system.*", "de.alpharogroup.resource.system.*.*", "de.alpharogroup.user.*", "de.alpharogroup.user.*.*", "de.alpharogroup.user.management.*", "de.alpharogroup.user.management.*.*" });
    JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    em.setJpaVendorAdapter(vendorAdapter);
    em.setJpaProperties(jpaProperties());
    return em;
}
Also used : JpaVendorAdapter(org.springframework.orm.jpa.JpaVendorAdapter) HibernateJpaVendorAdapter(org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter) HibernateJpaVendorAdapter(org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean) DataSourceBean(de.alpharogroup.springconfig.DataSourceBean) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean) JdbcUrlBean(de.alpharogroup.springconfig.JdbcUrlBean)

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