use of org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean in project tutorials by eugenp.
the class AppConfig method entityManagerFactory.
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource());
em.setPackagesToScan(new String[] { "com.baeldung.models" });
em.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
em.setJpaProperties(additionalProperties());
return em;
}
use of org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean in project tutorials by eugenp.
the class DataStoreConfig method entityManagerFactory.
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource) {
final LocalContainerEntityManagerFactoryBean bean = new LocalContainerEntityManagerFactoryBean();
bean.setDataSource(dataSource);
bean.setJpaVendorAdapter(jpaVendorAdapter());
bean.setPackagesToScan("com.baeldung.springsecuredsockets");
// Set properties on Hibernate
Properties properties = new Properties();
properties.setProperty("hibernate.dialect", "org.hibernate.dialect.H2Dialect");
properties.setProperty("hibernate.hbm2ddl.auto", "update");
bean.setJpaProperties(properties);
return bean;
}
use of org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean in project tutorials by eugenp.
the class PersistenceJPAConfig method entityManagerFactory.
//
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource());
em.setPackagesToScan(new String[] { "org.baeldung.rolesauthorities" });
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
em.setJpaVendorAdapter(vendorAdapter);
em.setJpaProperties(additionalProperties());
return em;
}
use of org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean in project ariADDna by StnetixDevTeam.
the class JPAConfiguration method entityManagerFactory.
@Bean
public EntityManagerFactory entityManagerFactory() throws SQLException {
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setGenerateDdl(true);
LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setJpaVendorAdapter(vendorAdapter);
factory.setPackagesToScan("com.stnetix.ariaddna.persistence.entities");
factory.setDataSource(dataSource());
Properties properties = new Properties();
properties.put("hibernate.default_schema", "public");
properties.put("hibernate.hbm2ddl.auto", "create-drop");
properties.put("hibernate.show_sql", "true");
properties.put("hibernate.format_sql", "true");
properties.put("hibernate.use_sql_comments", "true");
properties.put("hibernate.temp.use_jdbc_metadata_defaults", "false");
properties.put("hibernate.dialect", dialect);
factory.setJpaProperties(properties);
factory.afterPropertiesSet();
return factory.getObject();
}
use of org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean 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;
}
Aggregations