当前位置: 首页>>代码示例>>Java>>正文


Java LocalContainerEntityManagerFactoryBean.setJpaProperties方法代码示例

本文整理汇总了Java中org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.setJpaProperties方法的典型用法代码示例。如果您正苦于以下问题:Java LocalContainerEntityManagerFactoryBean.setJpaProperties方法的具体用法?Java LocalContainerEntityManagerFactoryBean.setJpaProperties怎么用?Java LocalContainerEntityManagerFactoryBean.setJpaProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean的用法示例。


在下文中一共展示了LocalContainerEntityManagerFactoryBean.setJpaProperties方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: entityManagerFactory

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
@Bean
public EntityManagerFactory entityManagerFactory() {
	LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
	emf.setDataSource(dataSource());
	emf.setPackagesToScan("io.github.azanx.shopping_list.domain");
	emf.setPersistenceUnitName("spring-jpa-unit");
	emf.setJpaVendorAdapter(getHibernateAdapter());
	Properties jpaProperties = new Properties();
	jpaProperties.put("hibernate.dialect", env.getProperty("hibernate.dialect"));
	jpaProperties.put("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));
	jpaProperties.put("hibernate.show_sql", env.getProperty("hibernate.show_sql"));
	jpaProperties.put("hibernate.format_sql", env.getProperty("hibernate.format_sql"));
	emf.setJpaProperties(jpaProperties);
	emf.afterPropertiesSet();
	return emf.getObject();
}
 
开发者ID:Azanx,项目名称:Smart-Shopping,代码行数:17,代码来源:JPAConfig.java

示例2: entityManagerFactory

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
@Bean
public EntityManagerFactory entityManagerFactory(DataSource dataSource) {
    final Database database = Database.valueOf(vendor.toUpperCase());
    /*
    final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setShowSql(showSql);
    vendorAdapter.setGenerateDdl(showDdl);
    vendorAdapter.setDatabase(database);
    */

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


    return factory.getObject();
}
 
开发者ID:nhsconnect,项目名称:careconnect-reference-implementation,代码行数:23,代码来源:DataSourceConfig.java

示例3: entityManagerFactory

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
    emf.setDataSource(dataSource);
    emf.setPackagesToScan(Constants.BASE_PACKAGE);
    emf.setPersistenceProvider(new HibernatePersistenceProvider());
    emf.setJpaProperties(jpaProperties());
    return emf;
}
 
开发者ID:lordking,项目名称:spring-rest-sample,代码行数:10,代码来源:JpaConfig.java

示例4: entityManagerFactory

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
	LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
	em.setDataSource(dataSource());
	em.setPackagesToScan(new String[] { "com.iisigroup.domain" });

	JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
	em.setJpaVendorAdapter(vendorAdapter);
	em.setJpaProperties(hibernateProperties());

	return em;
}
 
开发者ID:lf23617358,项目名称:training-sample,代码行数:13,代码来源:AppConfig.java

示例5: entityManagerFactory

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
@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;
}
 
开发者ID:hantsy,项目名称:spring-reactive-sample,代码行数:10,代码来源:JpaConfig.java

示例6: getEntityManager

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
@Bean(name="entityManagerFactory")
public LocalContainerEntityManagerFactoryBean getEntityManager(){
    // класса фабрики реализующей интерфейс FactoryBean<EntityManagerFactory>
    LocalContainerEntityManagerFactoryBean factory =
        new LocalContainerEntityManagerFactoryBean();

    // источник подключения
    factory.setDataSource(getDataSource());

    // адаптера для конкретной реализации JPA, 
    // указывает, какая библиотека будет использоваться в качестве постовщика
    factory.setJpaVendorAdapter(new HibernateJpaVendorAdapter());

    // указание пакета в котором находятся классы-сущности
    factory.setPackagesToScan("spring.domain");

    //создание свойств для настройки Hibernate
    Properties jpaProperties = new Properties();

    // диалект базы данных,необходимо для генерации запросов Hibernate к БД
    jpaProperties.put("hibernate.dialect", "org.hibernate.dialect.SQLiteDialect");

    // максимальная глубины связи(будет рассмотрено в след. уроке)
    jpaProperties.put("hibernate.max_fetch_depth", 3);

    // максимальное число строк, возвращаемых за один запрос из БД
    jpaProperties.put("hibernate.jdbc.fetch_size", 50);

    // максимальное число запросов при использовании пакетных операций
    jpaProperties.put("hibernate.jdbc.batch_size", 10);

    // включает логгирование
    jpaProperties.put("hibernate.show_sql", true);

    factory.setJpaProperties(jpaProperties);
    return factory;
}
 
开发者ID:biblelamp,项目名称:JavaEE,代码行数:38,代码来源:AppConfig.java

示例7: entityManagerFactory

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
	LocalContainerEntityManagerFactoryBean retVal = new LocalContainerEntityManagerFactoryBean();
	//retVal.setPersistenceUnitManager(persistenceUnitManager());
	retVal.setMappingResources(orm);
	retVal.setPackagesToScan("org.partners.usciitg_prep.terminology.jpa");
	retVal.setPersistenceUnitName(persistenceUnitName);
	retVal.setDataSource(dataSource());
	retVal.setPersistenceProvider(new HibernatePersistenceProvider());		
	retVal.setJpaProperties(jpaProperties());
	return retVal;
}
 
开发者ID:Discovery-Research-Network-SCCM,项目名称:FHIR-CQL-ODM-service,代码行数:13,代码来源:FhirServerTestConfigDstu3.java

示例8: archiveringEntityManagerFactory

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
/**
 * @return entity manager factory (archivering; alleen lezen)
 */
@Bean(name = ENTITY_MANAGER_ARCHIVERING)
@DependsOn(TRANSACTION_MANAGER)
public LocalContainerEntityManagerFactoryBean archiveringEntityManagerFactory() {
    final LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(archiveringDataSource());
    entityManagerFactoryBean.setPersistenceUnitName(PERSISTENCE_UNIT_ARCHIVERING);
    entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistenceProvider.class);
    entityManagerFactoryBean.setPackagesToScan(PACKAGE_USERTYPES, PACKAGE_STAMGEGEVEN_ENTITY, PACKAGE_BEHEER_VIEW);

    entityManagerFactoryBean.setJpaProperties(hibernateProperties());

    return entityManagerFactoryBean;
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:17,代码来源:RepositoryConfiguratie.java

示例9: kernEntityManagerFactory

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
/**
 * @return entity manager factory (kern; alleen lezen)
 */
@Bean(name = ENTITY_MANAGER_KERN)
@DependsOn(TRANSACTION_MANAGER)
public LocalContainerEntityManagerFactoryBean kernEntityManagerFactory() {
    final LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(kernDataSource());
    entityManagerFactoryBean.setPersistenceUnitName(PERSISTENCE_UNIT_KERN);
    entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistenceProvider.class);
    entityManagerFactoryBean.setPackagesToScan(PACKAGE_USERTYPES, PACKAGE_STAMGEGEVEN_ENTITY, PACKAGE_BEHEER_VIEW);

    entityManagerFactoryBean.setJpaProperties(hibernateProperties());

    return entityManagerFactoryBean;
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:17,代码来源:RepositoryConfiguratie.java

示例10: entityManagerFactory

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() throws NamingException {
	LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();
	factoryBean.setDataSource(dataSource());
	factoryBean.setPackagesToScan(new String[] { "com.docker.atsea.model" });
	factoryBean.setJpaVendorAdapter(jpaVendorAdapter());
	factoryBean.setJpaProperties(jpaProperties());
	return factoryBean;
}
 
开发者ID:dockersamples,项目名称:atsea-sample-shop-app,代码行数:10,代码来源:JpaConfiguration.java

示例11: entityManagerFactory

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource());
em.setPackagesToScan("org.restaurant.repository.model");

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

return em;
}
 
开发者ID:juanjo8600,项目名称:restaurant,代码行数:13,代码来源:RepositoryConfiguration.java

示例12: getLocalContainerEntityManagerFactoryBean

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean getLocalContainerEntityManagerFactoryBean() {
	LocalContainerEntityManagerFactoryBean bean = new LocalContainerEntityManagerFactoryBean();
	bean.setJpaProperties(hibernateProperties());
	bean.setPackagesToScan(TestEntity.class.getPackage().getName());
	bean.setDataSource(testDataSource());
	bean.setPersistenceUnitName("TEST");
	return bean;
}
 
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:10,代码来源:JpaTestConfig.java

示例13: getLocalContainerEntityManagerFactoryBean

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
@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;
}
 
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:10,代码来源:OperationsTestConfig.java

示例14: masterEntityManagerFactory

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
/**
 * @return entity manager factory (kern; schrijven)
 */
@Bean(name = ENTITY_MANAGER_MASTER)
@DependsOn(TRANSACTION_MANAGER)
public LocalContainerEntityManagerFactoryBean masterEntityManagerFactory() {
    final LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(masterDataSource());
    entityManagerFactoryBean.setPersistenceUnitName(PERSISTENCE_UNIT_MASTER);
    entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistenceProvider.class);
    entityManagerFactoryBean.setPackagesToScan(PACKAGE_USERTYPES, PACKAGE_STAMGEGEVEN_ENTITY, PACKAGE_BEHEER_VIEW);
    entityManagerFactoryBean.setJpaProperties(hibernateProperties());

    return entityManagerFactoryBean;
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:16,代码来源:RepositoryConfiguratie.java

示例15: entityManagerFactory

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
@Bean()
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
	LocalContainerEntityManagerFactoryBean retVal = new LocalContainerEntityManagerFactoryBean();
	retVal.setPersistenceUnitName("HAPI_PU");
	retVal.setDataSource(dataSource());
	retVal.setPackagesToScan("ca.uhn.fhir.jpa.entity");
	retVal.setPersistenceProvider(new HibernatePersistenceProvider());
	retVal.setJpaProperties(jpaProperties());
	return retVal;
}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:11,代码来源:FhirServerConfigDstu3.java


注:本文中的org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.setJpaProperties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。