use of org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean in project spring-boot by spring-projects.
the class AbstractJpaAutoConfigurationTests method customPersistenceUnitManager.
@Test
void customPersistenceUnitManager() {
this.contextRunner.withUserConfiguration(TestConfigurationWithCustomPersistenceUnitManager.class).run((context) -> {
LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = context.getBean(LocalContainerEntityManagerFactoryBean.class);
assertThat(entityManagerFactoryBean).hasFieldOrPropertyWithValue("persistenceUnitManager", context.getBean(PersistenceUnitManager.class));
});
}
use of org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean in project tutorials by eugenp.
the class MySQLAutoconfiguration method entityManagerFactory.
@Bean
@ConditionalOnBean(name = "dataSource")
@ConditionalOnMissingBean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource());
em.setPackagesToScan("com.baeldung.autoconfiguration.example");
em.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
if (additionalProperties() != null) {
em.setJpaProperties(additionalProperties());
}
return em;
}
use of org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean in project tutorials by eugenp.
the class H2JpaConfig method entityManagerFactory.
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource());
em.setPackagesToScan(new String[] { "org.baeldung.boot.domain", "org.baeldung.boot.model", "org.baeldung.boot.boottest", "org.baeldung.model" });
em.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
em.setJpaProperties(additionalProperties());
return em;
}
use of org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean in project tutorials by eugenp.
the class StudentJpaConfig method entityManagerFactory.
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource());
em.setPackagesToScan(new String[] { "org.baeldung.inmemory.persistence.model" });
em.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
em.setJpaProperties(additionalProperties());
return em;
}
use of org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean in project tutorials by eugenp.
the class PersistenceJNDIConfig method entityManagerFactory.
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() throws NamingException {
final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource());
em.setPackagesToScan(new String[] { "org.baeldung.persistence.model" });
em.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
em.setJpaProperties(additionalProperties());
return em;
}
Aggregations