org.hibernate.jpa.HibernatePersistenceProvider Java Examples

The following examples show how to use org.hibernate.jpa.HibernatePersistenceProvider. 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: DataEnversConfig.java    From spring4-sandbox with Apache License 2.0 6 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 #2
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 #3
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 #4
Source File: ProviderChecker.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Extract the requested persistence provider name using the algorithm Hibernate uses.  Namely, a provider named
 * in the 'integration' map (under the key '{@value AvailableSettings#JPA_PERSISTENCE_PROVIDER}') is preferred, as per-spec, over
 * value specified in persistence unit.
 *
 * @param persistenceUnit The {@code <persistence-unit/>} descriptor.
 * @param integration The integration values.
 *
 * @return The extracted provider name, or {@code null} if none found.
 */
public static String extractRequestedProviderName(PersistenceUnitDescriptor persistenceUnit, Map integration) {
	final String integrationProviderName = extractProviderName( integration );
	if ( integrationProviderName != null ) {
		log.debugf( "Integration provided explicit PersistenceProvider [%s]", integrationProviderName );
		return integrationProviderName;
	}

	final String persistenceUnitRequestedProvider = extractProviderName( persistenceUnit );
	if ( persistenceUnitRequestedProvider != null ) {
		log.debugf(
				"Persistence-unit [%s] requested PersistenceProvider [%s]",
				persistenceUnit.getName(),
				persistenceUnitRequestedProvider
		);
		return persistenceUnitRequestedProvider;
	}

	// NOTE : if no provider requested we assume we are the provider (the calls got to us somehow...)
	log.debug( "No PersistenceProvider explicitly requested, assuming Hibernate" );
	return HibernatePersistenceProvider.class.getName();
}
 
Example #5
Source File: AbstractJPAProgrammaticBootstrapTest.java    From high-performance-java-persistence with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    PersistenceUnitInfo persistenceUnitInfo = persistenceUnitInfo(getClass().getSimpleName());

    Map<String, Object> configuration = new HashMap<>();

    Integrator integrator = integrator();
    if (integrator != null) {
        configuration.put("hibernate.integrator_provider", (IntegratorProvider) () -> Collections.singletonList(integrator));
    }

    emf = new HibernatePersistenceProvider().createContainerEntityManagerFactory(
        persistenceUnitInfo,
        configuration
    );
}
 
Example #6
Source File: RapidoidThingsTest.java    From rapidoid with Apache License 2.0 6 votes vote down vote up
@Test
public void classesShouldExtendRapidoidThing() {
	for (String cls : Cls.getRapidoidClasses()) {

		if (cls.startsWith("org.rapidoid.plugin.app.")
			|| cls.startsWith("org.rapidoid.test.")) continue;

		Class<?> clazz = Cls.get(cls);

		if (!clazz.isInterface() && !clazz.isEnum() && !clazz.isAnnotation()) {
			U.must(RapidoidThing.class.isAssignableFrom(clazz)
				|| clazz == TestCommons.class
				|| Exception.class.isAssignableFrom(clazz)
				|| ClassLoader.class.isAssignableFrom(clazz)
				|| HibernatePersistenceProvider.class.isAssignableFrom(clazz)
				|| OutputStream.class.isAssignableFrom(clazz)
				|| Map.class.isAssignableFrom(clazz)
				|| JsonSerializer.class.isAssignableFrom(clazz)
				|| JsonDeserializer.class.isAssignableFrom(clazz)
				|| LogFactory.class.isAssignableFrom(clazz)
				|| Thread.class.isAssignableFrom(clazz), "" + cls);
		}
	}
}
 
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: WebAppConfig.java    From SA47 with The Unlicense 5 votes vote down vote up
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
	LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
	entityManagerFactoryBean.setDataSource(dataSource());
	entityManagerFactoryBean
			.setPersistenceProviderClass(HibernatePersistenceProvider.class);
	entityManagerFactoryBean
			.setPackagesToScan(env
					.getRequiredProperty(PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN));

	entityManagerFactoryBean.setJpaProperties(hibProperties());

	return entityManagerFactoryBean;
}
 
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: ScoreDatabaseContext.java    From score with Apache License 2.0 5 votes vote down vote up
@Bean
@DependsOn("liquibase")
LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource) {
    //Init the IdentityManager
    SimpleHiloIdentifierGenerator.setDataSource(dataSource);

    //Now create the bean
    LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
    emf.setDataSource(dataSource);
    emf.setJpaProperties(jpaProperties());
    emf.setJpaVendorAdapter(jpaVendorAdapter());
    emf.setPersistenceProviderClass(HibernatePersistenceProvider.class);
    emf.setPackagesToScan("io.cloudslang");
    return emf;
}
 
Example #12
Source File: EngineTest.java    From score with Apache License 2.0 5 votes vote down vote up
@Bean(name = "entityManagerFactory")
@DependsOn("liquibase")
LocalContainerEntityManagerFactoryBean emf(JpaVendorAdapter jpaVendorAdapter, Properties jpaProperties) {
    LocalContainerEntityManagerFactoryBean fb = new LocalContainerEntityManagerFactoryBean();
    fb.setDataSource(dataSource());
    fb.setJpaProperties(jpaProperties);
    fb.setPersistenceProviderClass(HibernatePersistenceProvider.class);
    fb.setPackagesToScan("io.cloudslang");
    fb.setJpaVendorAdapter(jpaVendorAdapter);
    return fb;
}
 
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: 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 #15
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 #16
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 #17
Source File: PartitionTemplateWithEmfTest.java    From score with Apache License 2.0 5 votes vote down vote up
@Bean
@DependsOn("liquibase")
LocalContainerEntityManagerFactoryBean entityManagerFactory(JpaVendorAdapter jpaVendorAdapter) {
    LocalContainerEntityManagerFactoryBean fb = new LocalContainerEntityManagerFactoryBean();
    fb.setDataSource(dataSource());
    fb.setPersistenceProviderClass(HibernatePersistenceProvider.class);
    fb.setPackagesToScan("io.cloudslang.engine.partitions");
    fb.setJpaVendorAdapter(jpaVendorAdapter);
    return fb;
}
 
Example #18
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 #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: 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 #21
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 #22
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 #23
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 #24
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 #25
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 #26
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 #27
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 #28
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 #29
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 #30
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;
}