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:com.sapito.db.config.PersistenceConfig.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() {
    LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();

    em.setDataSource(dataSource());/*from   ww  w . j av a  2s  .c o m*/
    em.setPackagesToScan(new String[] { "com.sapito.db.entities" });

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

    return em;
}

From source file:org.hellospring4.config.PersistenceConfig.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() {
    LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();

    em.setDataSource(dataSource());//from w w w . j a  v a2s  .  co  m
    em.setPackagesToScan(new String[] { "org.hellospring4.entities" });

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

    return em;
}

From source file:org.spc.ofp.tubs.config.TubsAppConfig.java

@Bean(name = { "entityManagerFactory" })
public EntityManagerFactory entityManagerFactory() {
    final LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
    emf.setDataSource(dataSourceConfig.tubsDataSource());
    // FIXME Change this to read PU name from Spring configuration XML
    emf.setPersistenceUnitName(PU_NAME);
    emf.setJpaVendorAdapter(jpaAdapter());
    final Properties jpaProperties = new Properties();
    // FIXME Change this to read Hibernate dialect from Spring configuration XML
    // This sets us up for being able to use the GIS functionality in SQL Server via HibernateSpatial
    jpaProperties.setProperty("hibernate.dialect", "org.hibernatespatial.sqlserver.SQLServerSpatialDialect");
    jpaProperties.setProperty("hibernate.show_sql", "false");
    emf.setJpaProperties(jpaProperties);
    emf.afterPropertiesSet();//w w w .j av a 2 s . c o m
    return emf.getNativeEntityManagerFactory();
}

From source file:com.xumpy.security.root.InitDatabase.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean localContainerEntityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();

    localContainerEntityManagerFactoryBean.setDataSource(dataSource());
    localContainerEntityManagerFactoryBean.setJpaVendorAdapter(jpaVendorAdapter());
    localContainerEntityManagerFactoryBean.setJpaProperties(hibernatePropertiesJPA());
    localContainerEntityManagerFactoryBean.setPackagesToScan("com.xumpy.thuisadmin.dao.*",
            "com.xumpy.timesheets.dao.*", "com.xumpy.collections.dao.*");

    return localContainerEntityManagerFactoryBean;
}

From source file:com.devicehive.application.RdbmsPersistenceConfig.java

@Bean
@Autowired/*from  w w w.j  av a 2  s  .c  o m*/
@DependsOn(value = { "simpleApplicationContextHolder" })
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    final LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();
    factoryBean.setDataSource(dataSource);
    factoryBean.setSharedCacheMode(SharedCacheMode.ENABLE_SELECTIVE);
    factoryBean.setValidationMode(ValidationMode.CALLBACK);
    factoryBean.setJpaVendorAdapter(jpaVendorAdapter);
    factoryBean.setPackagesToScan("com.devicehive.model");

    final Properties props = new Properties();
    props.putAll(this.properties.getHibernateProperties(this.dataSource));
    factoryBean.setJpaProperties(props);
    return factoryBean;
}

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

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

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

    return em;
}

From source file:com.cami.spring.PersistenceJPAConfig.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setDataSource(dataSource());// w  ww. ja v  a2s.  c o  m
    em.setPackagesToScan(new String[] { "com.cami.persistence.model" });

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

    return em;
}

From source file:ru.portal.services.AppConfigTest.java

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

    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setShowSql(true);/*from  ww w .j  a  v  a2s .c  o  m*/

    LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setDataSource(this.dataSource());
    em.setPackagesToScan(new String[] { "ru.portal.entity" });
    em.setPersistenceUnitName("portalPersistanceUnit");

    em.setJpaVendorAdapter(vendorAdapter);
    em.setJpaProperties(additionalProperties());

    em.afterPropertiesSet();

    return em;

}

From source file:hub.config.jpa.HubConfigJpa.java

@Bean
public EntityManagerFactory entityManagerFactory() {

    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setGenerateDdl(true);//w w  w. j  av  a 2s. c  o m
    vendorAdapter.setShowSql(false);
    vendorAdapter.setDatabasePlatform("org.hibernate.dialect.MySQLDialect");

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan("things.thing", "hub.backends.users.types");
    factory.setDataSource(dataSource());
    factory.setMappingResources("thing.hbm.xml");
    factory.afterPropertiesSet();

    return factory.getObject();
}

From source file:com.urservices.urerp.ecole.config.context.PersistenceJPAConfig.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setDataSource(dataSource());/*from   w ww  .j  av  a2  s  . c om*/
    em.setPackagesToScan(new String[] { "com.urservices.urerp.ecole.adresse.entity", });

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

    return em;
}