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


Java EntityManagerFactoryBuilder类代码示例

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


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

示例1: entityManagerFactoryBuilder

import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
public EntityManagerFactoryBuilder entityManagerFactoryBuilder(
		JpaVendorAdapter jpaVendorAdapter,
		ObjectProvider<PersistenceUnitManager> persistenceUnitManagerProvider) {
	EntityManagerFactoryBuilder builder = new EntityManagerFactoryBuilder(
			jpaVendorAdapter, this.properties.getProperties(),
			persistenceUnitManagerProvider.getIfAvailable());
	builder.setCallback(getVendorCallback());
	return builder;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:JpaBaseConfiguration.java

示例2: entityManagerFactory

import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; //导入依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(
    EntityManagerFactoryBuilder factoryBuilder)
{
    Map<String, Object> vendorProperties = getVendorProperties();
    customizeVendorProperties(vendorProperties);
    LocalContainerEntityManagerFactoryBean emfb = factoryBuilder.dataSource(getDataSource())
        .packages(getPackagesToScan())
        .persistenceUnit("default")
        .properties(vendorProperties)
        .jta(isJta())
        .build();

    emfb.setPersistenceUnitPostProcessors(new JPosPersistentUnitPostProcessor());
    return emfb;
}
 
开发者ID:vmantek,项目名称:chimera,代码行数:17,代码来源:JPosDatabaseAutoConfiguration.java

示例3: workflowEntityManagerFactory

import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; //导入依赖的package包/类
/**
 * Create a {@Link LocalContainerEntityManagerFactoryBean} for the workflow datasource.
 */
@Bean
@WorkflowPersistenceUnit
public LocalContainerEntityManagerFactoryBean workflowEntityManagerFactory(
    EntityManagerFactoryBuilder builder,
    @WorkflowPersistenceUnit DataSource workflowDatasource) {

  LocalContainerEntityManagerFactoryBean factoryBean = builder
      .dataSource(workflowDatasource)
      .packages((String[]) null)
      .persistenceUnit(Constants.PERSISTENCE_UNIT_NAME)
      .jta(true)
      .build();

  // JBPM needs them
  factoryBean.getJpaPropertyMap().put("hibernate.max_fetch_depth", "3");
  factoryBean.getJpaPropertyMap().put("hibernate.id.new_generator_mappings", "false");

  return factoryBean;
}
 
开发者ID:indigo-dc,项目名称:orchestrator,代码行数:23,代码来源:JpaConfig.java

示例4: entityManagerFactory

import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; //导入依赖的package包/类
@Primary
@Bean(name = "oneEntityManagerFactory")
public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder) {
	DataSource dataSource = dataSource();

	return builder.dataSource(dataSource).packages("com.easynetcn.cloud.one.web.data.entity")
			.persistenceUnit("onePersistenceUnit").build();
}
 
开发者ID:easynet-cn,项目名称:easynetcn-cloud,代码行数:9,代码来源:OneJpaConfig.java

示例5: entityManagerFactoryUser

import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; //导入依赖的package包/类
@Bean(name = "entityManagerFactoryUser")
public LocalContainerEntityManagerFactoryBean entityManagerFactoryUser (EntityManagerFactoryBuilder builder) {
    return builder
            .dataSource(userDataSource)
            .properties(getVendorProperties(userDataSource))
            .packages(new String[]{ "com.myspringboot.repository.user", "com.myspringboot.entity" }) //设置应用userDataSource的基础包名
            .persistenceUnit("userPersistenceUnit")
            .build();
}
 
开发者ID:SnailFastGo,项目名称:springboot_op,代码行数:10,代码来源:UserDataSourceConfiguration.java

示例6: entityManagerFactoryBook

import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; //导入依赖的package包/类
@Primary
@Bean(name = "entityManagerFactoryBook")
public LocalContainerEntityManagerFactoryBean entityManagerFactoryBook (EntityManagerFactoryBuilder builder) {
    return builder
            .dataSource(bookDataSource)
            .properties(getVendorProperties(bookDataSource))
            .packages(new String[]{"com.myspringboot.repository.book", "com.myspringboot.entity"}) //设置应用bookDataSource的基础包名
            .persistenceUnit("bookPersistenceUnit")
            .build();
}
 
开发者ID:SnailFastGo,项目名称:springboot_op,代码行数:11,代码来源:BookDataSourceConfiguration.java

示例7: entityManagerFactory

import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; //导入依赖的package包/类
@Bean(name = "entityManagerFactory")
public LocalContainerEntityManagerFactoryBean entityManagerFactory(
        EntityManagerFactoryBuilder factory) {
    return factory.dataSource(dataSource())
            .packages("com.nixmash.blog.jpa")
            .properties(getVendorProperties(dataSource()))
            .build();
}
 
开发者ID:mintster,项目名称:nixmash-blog,代码行数:9,代码来源:MySqlConfig.java

示例8: firstEntityManagerFactory

import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; //导入依赖的package包/类
/**
 * 实体管理对象
 * @param builder 由spring注入这个对象,首先根据type注入(多个就取声明@Primary的对象),否则根据name注入
 * @return
 */
@Bean
@Primary
public LocalContainerEntityManagerFactoryBean firstEntityManagerFactory(
        EntityManagerFactoryBuilder builder) {
    return builder
            .dataSource(firstDataSource())
            .packages("com.jwcq.entity")
            .persistenceUnit("firstDs")
            .build();
}
 
开发者ID:luotuo,项目名称:springboot-security-wechat,代码行数:16,代码来源:AuditDsConfig.java

示例9: secondEntityManagerFactory

import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; //导入依赖的package包/类
/**
 * 实体管理对象
 * @param builder 由spring注入这个对象,首先根据type注入(多个就取声明@Primary的对象),否则根据name注入
 * @return
 */
@Bean(name = "secondEntityManagerFactory")
public LocalContainerEntityManagerFactoryBean secondEntityManagerFactory(
        EntityManagerFactoryBuilder builder) {
    return builder
            .dataSource(secondDataSource())
            .packages("com.jwcq.user.entity")
            .persistenceUnit("secondDs")
            .build();
}
 
开发者ID:luotuo,项目名称:springboot-security-wechat,代码行数:15,代码来源:UserDsConfig.java

示例10: readEntityManagerFactoryBean

import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; //导入依赖的package包/类
/**
 * EntityManagerFactory类似于Hibernate的SessionFactory,mybatis的SqlSessionFactory
 * 总之,在执行操作之前,我们总要获取一个EntityManager,这就类似于Hibernate的Session,
 * mybatis的sqlSession.
 * @return
 */
@Bean(name = "readEntityManagerFactoryBean")
public LocalContainerEntityManagerFactoryBean readEntityManagerFactoryBean(EntityManagerFactoryBuilder builder) {
    return builder
            .dataSource(readDruidDataSource)
            .properties(jpaProperties.getProperties())
            .packages("com.lc.springBoot.jpa.entity") //设置实体类所在位置
            .persistenceUnit("readPersistenceUnit")//持久化单元名称
            .build();
    //.getObject();
}
 
开发者ID:Lengchuan,项目名称:SpringBoot-Study,代码行数:17,代码来源:ReadDataSourceConfig1.java

示例11: writeEntityManagerFactoryBean

import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; //导入依赖的package包/类
/**
 * 我们通过LocalContainerEntityManagerFactoryBean来获取EntityManagerFactory实例
 * @return
 */
@Bean(name = "writeEntityManagerFactoryBean")
@Primary
public LocalContainerEntityManagerFactoryBean writeEntityManagerFactoryBean(EntityManagerFactoryBuilder builder) {
    return builder
            .dataSource(writeDruidDataSource)
            .properties(jpaProperties.getProperties())
            .packages("com.lc.springBoot.jpa.entity") //设置实体类所在位置
            .persistenceUnit("writePersistenceUnit")
            .build();
    //.getObject();//不要在这里直接获取EntityManagerFactory
}
 
开发者ID:Lengchuan,项目名称:SpringBoot-Study,代码行数:16,代码来源:WriteDataSourceConfig1.java

示例12: secondaryEntityManagerFactoryBean

import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; //导入依赖的package包/类
@Bean(name = "secondaryEntityManager")
public LocalContainerEntityManagerFactoryBean secondaryEntityManagerFactoryBean(EntityManagerFactoryBuilder builder) {
    return builder
            .dataSource(secondaryDataSource())
            .properties(hibernateProperties())
            .packages("com.xiaofeng.domain") //设置实体类所在位置
            .persistenceUnit("secondaryPersistenceUnit")
            .build();
}
 
开发者ID:nellochen,项目名称:springboot-start,代码行数:10,代码来源:SecondaryConfig.java

示例13: primaryEntityManagerFactoryBean

import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; //导入依赖的package包/类
@Primary
@Bean(name = "primaryEntityManager")
public LocalContainerEntityManagerFactoryBean primaryEntityManagerFactoryBean(EntityManagerFactoryBuilder builder) {
    return builder
            .dataSource(primaryDataSource())
            .properties((hibernateProperties()))
            .packages("com.xiaofeng.domain") //设置实体类所在位置
            .persistenceUnit("primaryPersistenceUnit")
            .build();
}
 
开发者ID:nellochen,项目名称:springboot-start,代码行数:11,代码来源:PrimaryConfig.java

示例14: entityManagerFactoryBean

import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; //导入依赖的package包/类
public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean(String name, final DataSource dataSource) {
    EntityManagerFactoryBuilder emfBuilder = new EntityManagerFactoryBuilder(
            vendorAdapter(), getProperties(), null);
    Builder builder = emfBuilder
            .dataSource(dataSource)
            .persistenceUnit(name)
            .properties(getHibernateProperties(dataSource))
            .jta(false);
    if (ArrayUtils.isNotEmpty(annotatedClasses)) {
        builder.packages(annotatedClasses);
    } else {
        builder.packages(packageToScan);
    }
    return builder.build();
}
 
开发者ID:jkazama,项目名称:sample-boot-micro,代码行数:16,代码来源:OrmRepository.java

示例15: entityManagerFactory

import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; //导入依赖的package包/类
@Bean
@Primary
@ConditionalOnMissingBean({ LocalContainerEntityManagerFactoryBean.class,
		EntityManagerFactory.class })
public LocalContainerEntityManagerFactoryBean entityManagerFactory(
		EntityManagerFactoryBuilder factoryBuilder) {
	Map<String, Object> vendorProperties = getVendorProperties();
	customizeVendorProperties(vendorProperties);
	return factoryBuilder.dataSource(this.dataSource).packages(getPackagesToScan())
			.properties(vendorProperties).jta(isJta()).build();
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:JpaBaseConfiguration.java


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