Search in sources :

Example 71 with LocalContainerEntityManagerFactoryBean

use of org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean in project spring-sync by spring-projects.

the class EmbeddedDataSourceConfig method entityManagerFactory.

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean lef = new LocalContainerEntityManagerFactoryBean();
    lef.setDataSource(dataSource());
    lef.setJpaPropertyMap(this.jpaProperties());
    lef.setJpaVendorAdapter(this.jpaVendorAdapter());
    lef.setPackagesToScan("org.springframework.sync");
    return lef;
}
Also used : LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)

Example 72 with LocalContainerEntityManagerFactoryBean

use of org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean in project xm-ms-entity by xm-online.

the class DatabaseConfiguration method entityManagerFactory.

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource, MultiTenantConnectionProvider multiTenantConnectionProviderImpl, CurrentTenantIdentifierResolver currentTenantIdentifierResolverImpl, LocalValidatorFactoryBean localValidatorFactoryBean) {
    Map<String, Object> properties = new HashMap<>();
    properties.putAll(jpaProperties.getHibernateProperties(dataSource));
    properties.put(org.hibernate.cfg.Environment.MULTI_TENANT, MultiTenancyStrategy.SCHEMA);
    properties.put(org.hibernate.cfg.Environment.MULTI_TENANT_CONNECTION_PROVIDER, multiTenantConnectionProviderImpl);
    properties.put(org.hibernate.cfg.Environment.MULTI_TENANT_IDENTIFIER_RESOLVER, currentTenantIdentifierResolverImpl);
    properties.put(JPA_VALIDATION_FACTORY, localValidatorFactoryBean);
    LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setDataSource(dataSource);
    em.setPackagesToScan(JPA_PACKAGES);
    em.setJpaVendorAdapter(jpaVendorAdapter());
    em.setJpaPropertyMap(properties);
    return em;
}
Also used : HashMap(java.util.HashMap) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean) LocalValidatorFactoryBean(org.springframework.validation.beanvalidation.LocalValidatorFactoryBean) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)

Example 73 with LocalContainerEntityManagerFactoryBean

use of org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean in project gs-spring-security-3.2 by rwinch.

the class DataConfiguration method entityManagerFactory.

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setDatabase(Database.H2);
    vendorAdapter.setGenerateDdl(true);
    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan(Message.class.getPackage().getName());
    factory.setDataSource(dataSource());
    return factory;
}
Also used : HibernateJpaVendorAdapter(org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)

Example 74 with LocalContainerEntityManagerFactoryBean

use of org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean in project osms by malikov-yurii.

the class SpringDB method entityManagerFactory.

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setDataSource(dataSource());
    em.setPackagesToScan("com.malikov.**.domain");
    em.setJpaPropertyMap(ImmutableMap.of("hibernate.formal_sql", "false", "hibernate.use_sql_comments", "false"));
    JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    em.setJpaVendorAdapter(vendorAdapter);
    em.setJpaProperties(additionalProperties());
    return em;
}
Also used : JpaVendorAdapter(org.springframework.orm.jpa.JpaVendorAdapter) HibernateJpaVendorAdapter(org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter) HibernateJpaVendorAdapter(org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)

Example 75 with LocalContainerEntityManagerFactoryBean

use of org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean in project vertx-examples by vert-x3.

the class ExampleSpringConfiguration method entityManagerFactory.

@Bean
@Autowired
public LocalContainerEntityManagerFactoryBean entityManagerFactory(final DataSource dataSource) {
    final LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setDataSource(dataSource);
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setGenerateDdl(Boolean.TRUE);
    vendorAdapter.setShowSql(Boolean.TRUE);
    factory.setDataSource(dataSource);
    factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan("io.vertx.examples.spring.entity");
    Properties jpaProperties = new Properties();
    jpaProperties.put("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));
    jpaProperties.put("hibernate.show_sql", env.getProperty("hibernate.show_sql"));
    factory.setJpaProperties(jpaProperties);
    return factory;
}
Also used : HibernateJpaVendorAdapter(org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter) Properties(java.util.Properties) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean) Autowired(org.springframework.beans.factory.annotation.Autowired) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)

Aggregations

LocalContainerEntityManagerFactoryBean (org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)75 Bean (org.springframework.context.annotation.Bean)63 HibernateJpaVendorAdapter (org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter)42 Properties (java.util.Properties)14 JpaVendorAdapter (org.springframework.orm.jpa.JpaVendorAdapter)7 HashMap (java.util.HashMap)4 JpaConfigDataHolder (org.apereo.cas.configuration.model.support.jpa.JpaConfigDataHolder)4 Test (org.junit.jupiter.api.Test)4 DependsOn (org.springframework.context.annotation.DependsOn)4 Lazy (org.springframework.context.annotation.Lazy)4 AbstractJpaProperties (org.apereo.cas.configuration.model.support.jpa.AbstractJpaProperties)2 DatabaseProperties (org.apereo.cas.configuration.model.support.jpa.DatabaseProperties)2 Autowired (org.springframework.beans.factory.annotation.Autowired)2 Primary (org.springframework.context.annotation.Primary)2 DefaultPersistenceUnitManager (org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager)2 DatabaseManager (com.fredboat.backend.quarterdeck.db.DatabaseManager)1 AugmentableQueryRepositoryFactoryBean (com.thinkbiganalytics.metadata.jpa.feed.AugmentableQueryRepositoryFactoryBean)1 DataSourceBean (de.alpharogroup.springconfig.DataSourceBean)1 JdbcUrlBean (de.alpharogroup.springconfig.JdbcUrlBean)1 PersistenceUnitInfo (jakarta.persistence.spi.PersistenceUnitInfo)1