本文整理汇总了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;
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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
}
示例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();
}
示例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();
}
示例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();
}
示例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