Search in sources :

Example 1 with JpaVendorAdapter

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

the class HibernateSearchConfig method entityManagerFactory.

@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;
}
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) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)

Example 2 with JpaVendorAdapter

use of org.springframework.orm.jpa.JpaVendorAdapter in project invesdwin-context-persistence by subes.

the class PersistenceUnitContext method createEntityManagerFactory.

private EntityManagerFactory createEntityManagerFactory() {
    Assertions.assertThat(persistenceUnitContextManager.isValidPersistenceUnit(persistenceUnitName)).as("Not a valid persistence unit: %s", persistenceUnitName).isTrue();
    final LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setPersistenceUnitManager(persistenceUnitManager);
    factory.setPersistenceUnitName(persistenceUnitName);
    final JpaVendorAdapter jpaVendorAdapter = getJpaVendorAdapter();
    if (jpaVendorAdapter != null) {
        factory.setJpaVendorAdapter(jpaVendorAdapter);
    } else {
        factory.setPersistenceProvider(getPersistenceProvider());
    }
    final JpaDialect jpaDialect = getJpaDialect();
    if (jpaDialect != null) {
        factory.setJpaDialect(jpaDialect);
    }
    factory.afterPropertiesSet();
    final String entityManagerFactoryBeanName = getPersistenceUnitName() + PersistenceProperties.ENTITY_MANAGER_FACTORY_NAME_SUFFIX;
    MergedContext.getInstance().registerBean(entityManagerFactoryBeanName, factory);
    Assertions.assertThat(MergedContext.getInstance().getBean(entityManagerFactoryBeanName)).isNotNull();
    return factory.getObject();
}
Also used : JpaDialect(org.springframework.orm.jpa.JpaDialect) JpaVendorAdapter(org.springframework.orm.jpa.JpaVendorAdapter) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)

Example 3 with JpaVendorAdapter

use of org.springframework.orm.jpa.JpaVendorAdapter 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)

Example 4 with JpaVendorAdapter

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

the class PersistenceConfig method entityManagerFactory.

@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;
}
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) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean) LocalSessionFactoryBean(org.springframework.orm.hibernate4.LocalSessionFactoryBean)

Example 5 with JpaVendorAdapter

use of org.springframework.orm.jpa.JpaVendorAdapter in project survey by markoniemi.

the class JpaConfig method entityManagerFactory.

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setDataSource(dataSource());
    JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    em.setJpaVendorAdapter(vendorAdapter);
    em.setJpaProperties(additionalProperties());
    // em.setPackagesToScan("package.where.your.entites.like.CustSys.are.stored");
    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) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)

Aggregations

JpaVendorAdapter (org.springframework.orm.jpa.JpaVendorAdapter)7 LocalContainerEntityManagerFactoryBean (org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)7 Bean (org.springframework.context.annotation.Bean)6 HibernateJpaVendorAdapter (org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter)6 DatabaseManager (com.fredboat.backend.quarterdeck.db.DatabaseManager)1 DataSourceBean (de.alpharogroup.springconfig.DataSourceBean)1 JdbcUrlBean (de.alpharogroup.springconfig.JdbcUrlBean)1 LocalSessionFactoryBean (org.springframework.orm.hibernate4.LocalSessionFactoryBean)1 JpaDialect (org.springframework.orm.jpa.JpaDialect)1 DatabaseConnection (space.npstr.sqlsauce.DatabaseConnection)1