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

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

Introduction

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

Prototype

public void setJpaProperties(Properties jpaProperties) 

Source Link

Document

Specify JPA properties, to be passed into Persistence.createEntityManagerFactory (if any).

Usage

From source file:com.tamnd.app.config.HibernateConfig.java

@Bean
@Autowired//from   www.  j a  va2s  . c om
public LocalContainerEntityManagerFactoryBean sessionFactory(DataSource h2DataSource) {
    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setDataSource(h2DataSource);
    factory.setPackagesToScan(new String[] { "com.tamnd.app.core.entities" });
    factory.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
    factory.setJpaProperties(hibernateProperties());

    return factory;
}

From source file:se.ivankrizsan.messagecowboy.testconfig.PersistenceTestConfiguration.java

/**
 * JPA entity manager factory bean./*from  w  ww.ja  v a  2s. co  m*/
 */
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    /* JPA entity manager factory. */
    final LocalContainerEntityManagerFactoryBean theJpaEntityManagerFactory = new LocalContainerEntityManagerFactoryBean();
    theJpaEntityManagerFactory.setDataSource(dataSource());
    theJpaEntityManagerFactory.setPersistenceUnitName("message-cowboy");
    theJpaEntityManagerFactory.setJpaProperties(jpaProperties());

    /* JPA vendor adapter. */
    final EclipseLinkJpaVendorAdapter theJpaVendorAdapter = new EclipseLinkJpaVendorAdapter();
    theJpaVendorAdapter.setShowSql(true);

    theJpaEntityManagerFactory.setJpaVendorAdapter(theJpaVendorAdapter);

    return theJpaEntityManagerFactory;
}

From source file:com.ipet.server.config.JPAConfiguration.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource,
        JpaVendorAdapter jpaVendorAdapter) {
    LocalContainerEntityManagerFactoryBean lef = new LocalContainerEntityManagerFactoryBean();
    lef.setPersistenceUnitName("default");
    lef.setPackagesToScan("com.ipet.server");
    lef.setDataSource(dataSource);// w ww .j  ava  2  s .  c  o m
    lef.setJpaVendorAdapter(jpaVendorAdapter);
    lef.setJpaProperties(getJpaProperties());
    //return lef;
    return null;
}

From source file:org.fon.documentmanagementsystem.config.AppConfig.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() throws NamingException {
    LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setDataSource(dataSource());/* www  . jav a 2 s.  c o  m*/
    em.setJpaVendorAdapter(eclipseLinkJpaVendorAdapter());
    em.setPackagesToScan("org.fon.documentmanagementsystem.*");
    em.setJpaProperties(jpaProperties());
    return em;
}

From source file:com.github.fharms.camel.entitymanager.config.PersistenceJPAConfig.java

@Bean(name = "emf")
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setPackagesToScan("com.github.fharms");

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

    return em;//ww  w  . j  ava 2  s. c o m
}

From source file:com.github.fharms.camel.entitymanager.config.PersistenceJPAConfig.java

@Bean(name = "emf2")
public LocalContainerEntityManagerFactoryBean entityManagerFactory2() {
    LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setPackagesToScan("com.github.fharms");

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

    return em;//from  w ww  .ja  v a  2 s . c  om
}

From source file:com.iopr.PersistenceJPAConfig.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setDataSource(dataSource());/*from ww  w  . java  2 s.  c  o m*/
    em.setPackagesToScan(new String[] { "com.iopr.model" });
    JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    em.setJpaVendorAdapter(vendorAdapter);
    em.setJpaProperties(additionalProperties());
    return em;
}

From source file:uk.co.parso.barebones.DbConfig.java

@Bean(name = "testEntityManagerFactory")
public LocalContainerEntityManagerFactoryBean testEntityManagerFactory() throws SQLException {
    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setPackagesToScan("uk.co.parso.barebones.entities");
    factory.setDataSource(testDataSource());
    factory.setPersistenceProviderClass(HibernatePersistenceProvider.class);
    factory.setJpaProperties(hibProperties());
    factory.afterPropertiesSet();/*from  w w  w. j a va2  s .c  o m*/
    factory.setJpaDialect(new HibernateJpaDialect());

    HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    adapter.setDatabase(Database.MYSQL);
    factory.setJpaVendorAdapter(adapter);

    return factory;
}

From source file:com.store.PersistenceJPAConfig.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setDataSource(dataSource());//w w  w . j a  v a  2s  . com
    em.setPackagesToScan(new String[] { "com.store.model" });

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

    return em;
}

From source file:ru.develgame.jflickrorganizer.MainClass.java

@Bean
public EntityManagerFactory entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
    emf.setDataSource(dataSource());//from ww  w .j av a 2  s  .  co m
    emf.setJpaVendorAdapter(jpaVendorAdapter());
    emf.setPackagesToScan("ru.develgame.jflickrorganizer.entities");
    emf.setJpaProperties(additionalProperties());
    emf.afterPropertiesSet();

    return emf.getObject();
}