Java Code Examples for org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean#setPersistenceProvider()

The following examples show how to use org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean#setPersistenceProvider() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JpaTransactionManagerConfiguration.java    From hypersistence-optimizer with Apache License 2.0 7 votes vote down vote up
@Bean
public EntityManagerFactory entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setPersistenceUnitName(persistenceUnitName());
    entityManagerFactoryBean.setPersistenceProvider(new HibernatePersistence());
    entityManagerFactoryBean.setDataSource(dataSource());
    entityManagerFactoryBean.setPackagesToScan(packagesToScan());

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

    entityManagerFactoryBean.afterPropertiesSet();

    return HypersistenceHibernatePersistenceProvider.decorate(
        entityManagerFactoryBean.getNativeEntityManagerFactory()
    );
}
 
Example 2
Source File: DataSourceConfig.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@Bean
public EntityManagerFactory entityManagerFactory() {
  //  final Database database = Database.valueOf(vendor.toUpperCase());

    final LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setPersistenceUnitName("CCRI_PERSISTENCE_UNIT");
   // factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan("uk.nhs.careconnect.ri.database.entity");
    factory.setDataSource(dataSource());
    factory.setPersistenceProvider(new HibernatePersistenceProvider());
    factory.setJpaProperties(jpaProperties());
    factory.afterPropertiesSet();


    return factory.getObject();
}
 
Example 3
Source File: DaoConfig.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@Bean
public EntityManagerFactory entityManagerFactory() {
    //  final Database database = Database.valueOf(vendor.toUpperCase());

    final LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setPersistenceUnitName("CCRI_PERSISTENCE_UNIT");
    // factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan("uk.nhs.careconnect.ri.database.entity");
    factory.setDataSource(dataSource());
    factory.setPersistenceProvider(new HibernatePersistenceProvider());
    factory.setJpaProperties(jpaProperties());
    factory.afterPropertiesSet();


    return factory.getObject();
}
 
Example 4
Source File: JpaConfig.java    From spring4-sandbox with Apache License 2.0 5 votes vote down vote up
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
	LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
	emf.setDataSource(dataSource());
	emf.setPackagesToScan("com.hantsylabs.example.spring.model");
	emf.setPersistenceProvider(new HibernatePersistenceProvider());
	emf.setJpaProperties(jpaProperties());
	return emf;
}
 
Example 5
Source File: JpaConfig.java    From spring4-sandbox with Apache License 2.0 5 votes vote down vote up
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
	LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
	emf.setDataSource(dataSource());
	emf.setPackagesToScan("com.hantsylabs.example.spring.model");
	emf.setPersistenceProvider(new HibernatePersistenceProvider());
	emf.setJpaProperties(jpaProperties());
	return emf;
}
 
Example 6
Source File: JpaConfig.java    From spring4-sandbox with Apache License 2.0 5 votes vote down vote up
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
	LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
	emf.setDataSource(dataSource());
	emf.setPackagesToScan("com.hantsylabs.example.spring.model");
	emf.setPersistenceProvider(new HibernatePersistenceProvider());
	emf.setJpaProperties(jpaProperties());
	return emf;
}
 
Example 7
Source File: JpaConfig.java    From spring4-sandbox with Apache License 2.0 5 votes vote down vote up
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
	LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
	emf.setDataSource(dataSource());
	emf.setPackagesToScan("com.hantsylabs.example.spring.model");
	emf.setPersistenceProvider(new HibernatePersistenceProvider());
	emf.setJpaProperties(jpaProperties());
	return emf;
}
 
Example 8
Source File: JpaConfig.java    From spring4-sandbox with Apache License 2.0 5 votes vote down vote up
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
	LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
	emf.setDataSource(dataSource());
	emf.setPackagesToScan("com.hantsylabs.example.spring.model");
	emf.setPersistenceProvider(new HibernatePersistenceProvider());
	emf.setJpaProperties(jpaProperties());
	return emf;
}
 
Example 9
Source File: JpaConfig.java    From spring4-sandbox with Apache License 2.0 5 votes vote down vote up
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
	LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
	emf.setDataSource(dataSource());
	emf.setPackagesToScan("com.hantsylabs.example.spring.model");
	emf.setPersistenceProvider(new HibernatePersistenceProvider());
	emf.setJpaProperties(jpaProperties());
	return emf;
}
 
Example 10
Source File: JpaConfig.java    From spring4-sandbox with Apache License 2.0 5 votes vote down vote up
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
	LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
	emf.setDataSource(dataSource());
	emf.setPackagesToScan("com.hantsylabs.example.spring.model");
	emf.setPersistenceProvider(new HibernatePersistenceProvider());
	emf.setJpaProperties(jpaProperties());
	return emf;
}
 
Example 11
Source File: JpaConfig.java    From spring4-sandbox with Apache License 2.0 5 votes vote down vote up
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
	LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
	emf.setDataSource(dataSource());
	emf.setPackagesToScan("com.hantsylabs.example.spring.model");
	emf.setPersistenceProvider(new HibernatePersistenceProvider());
	emf.setJpaProperties(jpaProperties());
	return emf;
}
 
Example 12
Source File: JpaConfig.java    From spring4-sandbox with Apache License 2.0 5 votes vote down vote up
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
	LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
	emf.setDataSource(dataSource());
	emf.setPackagesToScan("com.hantsylabs.example.spring.model");
	emf.setPersistenceProvider(new HibernatePersistenceProvider());
	emf.setJpaProperties(jpaProperties());
	emf.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
	return emf;
}
 
Example 13
Source File: JpaConfig.java    From spring4-sandbox with Apache License 2.0 5 votes vote down vote up
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
	LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
	emf.setDataSource(dataSource());
	emf.setPackagesToScan("com.hantsylabs.example.spring.model");
	emf.setPersistenceProvider(new HibernatePersistenceProvider());
	emf.setJpaProperties(jpaProperties());
	return emf;
}
 
Example 14
Source File: BehaviorDrivenInheritanceConfiguration.java    From high-performance-java-persistence with Apache License 2.0 5 votes vote down vote up
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean localContainerEntityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    localContainerEntityManagerFactoryBean.setPersistenceUnitName(getClass().getSimpleName());
    localContainerEntityManagerFactoryBean.setPersistenceProvider(new HibernatePersistenceProvider());
    localContainerEntityManagerFactoryBean.setDataSource(dataSource());
    localContainerEntityManagerFactoryBean.setPackagesToScan(packagesToScan());

    JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    localContainerEntityManagerFactoryBean.setJpaVendorAdapter(vendorAdapter);
    localContainerEntityManagerFactoryBean.setJpaProperties(additionalProperties());
    return localContainerEntityManagerFactoryBean;
}
 
Example 15
Source File: JTATransactionManagerConfiguration.java    From high-performance-java-persistence with Apache License 2.0 5 votes vote down vote up
@Bean
@DependsOn("btmConfig")
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean localContainerEntityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    localContainerEntityManagerFactoryBean.setPersistenceUnitName(getClass().getSimpleName());
    localContainerEntityManagerFactoryBean.setPersistenceProvider(new HibernatePersistenceProvider());
    localContainerEntityManagerFactoryBean.setJtaDataSource(dataSource());
    localContainerEntityManagerFactoryBean.setPackagesToScan(packagesToScan());

    JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    localContainerEntityManagerFactoryBean.setJpaVendorAdapter(vendorAdapter);
    localContainerEntityManagerFactoryBean.setJpaProperties(additionalProperties());
    return localContainerEntityManagerFactoryBean;
}
 
Example 16
Source File: JPATransactionManagerConfiguration.java    From high-performance-java-persistence with Apache License 2.0 5 votes vote down vote up
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setPersistenceUnitName(getClass().getSimpleName());
    entityManagerFactoryBean.setPersistenceProvider(new HibernatePersistenceProvider());
    entityManagerFactoryBean.setDataSource(dataSource());
    entityManagerFactoryBean.setPackagesToScan(packagesToScan());

    JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    entityManagerFactoryBean.setJpaVendorAdapter(vendorAdapter);
    entityManagerFactoryBean.setJpaProperties(additionalProperties());
    return entityManagerFactoryBean;
}
 
Example 17
Source File: JpaConfig.java    From spring4-sandbox with Apache License 2.0 5 votes vote down vote up
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
	LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
	emf.setDataSource(dataSource());
	emf.setPackagesToScan("com.hantsylabs.example.spring.model");
	emf.setPersistenceProvider(new HibernatePersistenceProvider());
	emf.setJpaProperties(jpaProperties());
	return emf;
}
 
Example 18
Source File: JpaConfig.java    From spring-reactive-sample with GNU General Public License v3.0 5 votes vote down vote up
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource) {
    LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
    emf.setDataSource(dataSource);
    emf.setPackagesToScan(Post.class.getPackage().getName());
    emf.setPersistenceProvider(new HibernatePersistenceProvider());
    emf.setJpaProperties(jpaProperties());
    return emf;
}
 
Example 19
Source File: JpaConfig.java    From spring4-sandbox with Apache License 2.0 5 votes vote down vote up
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
	LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
	emf.setDataSource(dataSource());
	emf.setPackagesToScan("com.hantsylabs.example.spring.model");
	emf.setPersistenceProvider(new HibernatePersistenceProvider());
	emf.setJpaProperties(jpaProperties());
	return emf;
}
 
Example 20
Source File: JpaTransactionManagerConfiguration.java    From hypersistence-optimizer with Apache License 2.0 5 votes vote down vote up
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setPersistenceUnitName(persistenceUnitName());
    entityManagerFactoryBean.setPersistenceProvider(new HibernatePersistenceProvider());
    entityManagerFactoryBean.setDataSource(dataSource());
    entityManagerFactoryBean.setPackagesToScan(packagesToScan());

    JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    entityManagerFactoryBean.setJpaVendorAdapter(vendorAdapter);
    entityManagerFactoryBean.setJpaProperties(additionalProperties());
    return entityManagerFactoryBean;
}