Example usage for org.springframework.orm.jpa LocalContainerEntityManagerFactoryBean setJpaVendorAdapter

List of usage examples for org.springframework.orm.jpa LocalContainerEntityManagerFactoryBean setJpaVendorAdapter

Introduction

In this page you can find the example usage for org.springframework.orm.jpa LocalContainerEntityManagerFactoryBean setJpaVendorAdapter.

Prototype

public void setJpaVendorAdapter(@Nullable JpaVendorAdapter jpaVendorAdapter) 

Source Link

Document

Specify the JpaVendorAdapter implementation for the desired JPA provider, if any.

Usage

From source file:mg.jerytodik.business.config.JeryTodikConfig.java

@Bean(name = "entityManagerFactory")
public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() {

    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();

    entityManagerFactoryBean.setDataSource(dataSource());
    entityManagerFactoryBean.setPackagesToScan("mg.jerytodik.common.entity");
    entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
    entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistenceProvider.class);

    Properties properties = new Properties();

    properties.put(HibernateUtil.HIBERNATE_DIALECT, env.getProperty(HibernateUtil.HIBERNATE_DIALECT));
    properties.put(HibernateUtil.HIBERNATE_SHOW_SQL, env.getProperty(HibernateUtil.HIBERNATE_SHOW_SQL));
    properties.put(HibernateUtil.HIBERNATE_FORMAT_SQL, env.getProperty(HibernateUtil.HIBERNATE_FORMAT_SQL));
    properties.put(HibernateUtil.HIBERNATE_HBM2DDL_AUTO, env.getProperty(HibernateUtil.HIBERNATE_HBM2DDL_AUTO));

    entityManagerFactoryBean.setJpaProperties(properties);
    return entityManagerFactoryBean;
}

From source file:com.mycompany.spring2explore.config.PersistenceJPAConfig.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setDataSource(dataSource());/*  w  w  w  .  j  a  va 2 s . c o m*/
    em.setPackagesToScan(new String[] { "com.mycompany.spring2explore.entities" });

    JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    em.setJpaVendorAdapter(vendorAdapter);
    em.setJpaProperties(additionalProperties());

    return em;
}

From source file:es.galvarez.rest.config.SpringConfiguration.java

@Bean(name = "entityManagerFactory")
public LocalContainerEntityManagerFactoryBean configureEntityManagerFactory() {
    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(configureDataSource());
    entityManagerFactoryBean.setPackagesToScan(BASE_PACKAGES);
    entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());

    Properties jpaProperties = new Properties();
    jpaProperties.put(org.hibernate.cfg.Environment.DIALECT, dialect);
    jpaProperties.put(org.hibernate.cfg.Environment.HBM2DDL_AUTO, hbm2ddlAuto);
    entityManagerFactoryBean.setJpaProperties(jpaProperties);

    return entityManagerFactoryBean;
}

From source file:br.eti.danielcamargo.backend.common.config.context.CoreConfig.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() throws PropertyVetoException {
    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setPackagesToScan("br.com.danielcamargo.backend.hsnpts.core.domain");
    factory.setDataSource(dataSource());
    factory.setJpaVendorAdapter(jpaVendorAdapter());

    Map<String, String> map = new HashMap<>();

    map.put("hibernate.dialect", env.getProperty("database.dialect"));
    map.put("hibernate.hbm2ddl.auto", env.getProperty("database.ddlgen"));
    map.put("hibernate.connection.charSet", "UTF-8");
    map.put("hibernate.show_sql", "true");

    map.put("hibernate.hbm2ddl.import_files", "import.sql");

    factory.setJpaPropertyMap(map);//from   ww  w .  j  a v a2 s.  com
    return factory;
}

From source file:me.bulat.jivr.webmin.config.DataAppConfig.java

@Profile("default")
@Bean(name = "userEntityManagerFactory")
public LocalContainerEntityManagerFactoryBean configureEntityManagerFactory() {
    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(dataSource());
    entityManagerFactoryBean.setPackagesToScan("me.bulat.jivr.webmin.data.*");
    entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());

    Properties jpaProperties = new Properties();
    jpaProperties.put(org.hibernate.cfg.Environment.DIALECT, dialect);
    jpaProperties.put(org.hibernate.cfg.Environment.HBM2DDL_AUTO, hbm2ddlAuto);
    jpaProperties.put(Environment.SHOW_SQL, showSql);
    entityManagerFactoryBean.setJpaProperties(jpaProperties);

    return entityManagerFactoryBean;
}

From source file:com.alejandroszlv.mock.repository.config.RepositoryConfig.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setDataSource(dataSource());/*from ww  w .  j  a v a  2  s  .c  o m*/
    em.setPackagesToScan(new String[] { "com.alejandroszlv.mock.entity" });

    JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    em.setJpaVendorAdapter(vendorAdapter);
    em.setJpaProperties(additionalProperties());

    return em;
}

From source file:com.coffeebeans.persistence.config.PersistenceConfig.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setDataSource(dataSource());/*from   ww w .j  ava  2 s  .c o  m*/
    em.setPackagesToScan(env.getProperty(Constants.COFFEEBEANS_MODEL_PACKAGE));
    JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    em.setJpaVendorAdapter(vendorAdapter);
    em.setJpaProperties(additionalProperties());
    return em;
}

From source file:gov.nih.nci.cacis.xds.authz.config.JpaConfig.java

/**
 * Entity manager factory./*  w ww  . j av  a2  s  .com*/
 *
 * @return the entity manager factory
 */
@Bean(name = "entityManagerFactory")
public EntityManagerFactory entityManagerFactory() {
    final LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setPersistenceUnitName(PERSISTENCE_UNIT_NAME);
    entityManagerFactoryBean.setDataSource(dataSource());
    entityManagerFactoryBean.setJpaVendorAdapter(jpaVendorAdapter());
    entityManagerFactoryBean.setPersistenceXmlLocation("classpath*:META-INF/xds-beans-persistence.xml");

    // must set the properties
    entityManagerFactoryBean.afterPropertiesSet();
    return entityManagerFactoryBean.getObject();
}

From source file:dubbo.spring.javaconfig.DatabaseConfig.java

/**
 * ?/*  w w  w.  jav a 2s. co  m*/
 */
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() throws IOException {
    LocalContainerEntityManagerFactoryBean entityManagerFactory = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactory.setDataSource(dataSource());
    entityManagerFactory.setJpaVendorAdapter(jpaVendorAdapter());
    entityManagerFactory.setJpaProperties(hibernateConfig().getObject());
    entityManagerFactory.setPackagesToScan("com.wiiyaya.provider.*.entity");
    return entityManagerFactory;
}

From source file:gov.nih.nci.integration.dao.JpaConfig.java

/**
 * Entity manager factory.//from   ww w  .j  av  a  2 s . co m
 * 
 * @return the entity manager factory
 */
@Bean(name = "entityManagerFactory")
public EntityManagerFactory entityManagerFactory() {
    final LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();

    entityManagerFactoryBean.setPersistenceUnitName(PERSISTENCE_UNIT_NAME);
    entityManagerFactoryBean.setDataSource(dataSource());
    entityManagerFactoryBean.setJpaVendorAdapter(jpaVendorAdapter());
    entityManagerFactoryBean.setPersistenceXmlLocation("classpath*:META-INF/ihub-messages-persistence.xml");

    // must set the properties
    entityManagerFactoryBean.afterPropertiesSet();
    return entityManagerFactoryBean.getObject();
}