use of org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850PersistenceConfig method iec61850EntityManagerFactory.
/**
* Method for creating the Entity Manager Factory Bean.
*
* @return LocalContainerEntityManagerFactoryBean
* @throws ClassNotFoundException
* when class not found
*/
@Bean
@DependsOn("iec61850Flyway")
public LocalContainerEntityManagerFactoryBean iec61850EntityManagerFactory() throws ClassNotFoundException {
final LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
entityManagerFactoryBean.setPersistenceUnitName("OSGP_PROTOCOL_ADAPTER_IEC61850");
entityManagerFactoryBean.setDataSource(this.iec61850DataSource());
entityManagerFactoryBean.setPackagesToScan(this.entityManagerPackagesToScan);
entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistence.class);
final Properties jpaProperties = new Properties();
jpaProperties.put(PROPERTY_NAME_HIBERNATE_DIALECT, this.hibernateDialect);
jpaProperties.put(PROPERTY_NAME_HIBERNATE_FORMAT_SQL, this.hibernateFormatSql);
jpaProperties.put(PROPERTY_NAME_HIBERNATE_NAMING_STRATEGY, this.hibernateNamingStrategy);
jpaProperties.put(PROPERTY_NAME_HIBERNATE_SHOW_SQL, this.hibernateShowSql);
entityManagerFactoryBean.setJpaProperties(jpaProperties);
return entityManagerFactoryBean;
}
use of org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean in project nikita-noark5-core by HiOA-ABI.
the class DataSourceConfig method entityManagerFactory.
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource());
// Scan the Noark domain model from core-common and application domain model
em.setPackagesToScan("nikita.model", "no.arkivlab.hioa.nikita.webapp.model");
final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
em.setJpaVendorAdapter(vendorAdapter);
em.setJpaProperties(additionalProperties());
return em;
}
use of org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean 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();
}
use of org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean 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;
}
use of org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean in project crnk-framework by crnk-project.
the class OperationsTestConfig method getLocalContainerEntityManagerFactoryBean.
@Bean
public LocalContainerEntityManagerFactoryBean getLocalContainerEntityManagerFactoryBean() {
LocalContainerEntityManagerFactoryBean bean = new LocalContainerEntityManagerFactoryBean();
bean.setJpaProperties(hibernateProperties());
bean.setPackagesToScan(MovieEntity.class.getPackage().getName());
bean.setDataSource(testDataSource());
bean.setPersistenceUnitName("TEST");
return bean;
}
Aggregations