类 EntityManagerFactoryBuilder
java.lang.Object
org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder
Convenient builder for JPA EntityManagerFactory instances. Collects common
configuration when constructed and then allows you to create one or more
LocalContainerEntityManagerFactoryBean
through a fluent builder pattern. The
most common options are covered in the builder, but you can always manipulate the
product of the builder if you need more control, before returning it from a
@Bean
definition.- 从以下版本开始:
- 1.3.0
- 作者:
- Dave Syer, Phillip Webb, Stephane Nicoll
-
嵌套类概要
嵌套类修饰符和类型类说明final class
A fluent builder for a LocalContainerEntityManagerFactoryBean. -
构造器概要
构造器构造器说明EntityManagerFactoryBuilder
(JpaVendorAdapter jpaVendorAdapter, Function<DataSource, Map<String, ?>> jpaPropertiesFactory, PersistenceUnitManager persistenceUnitManager) Create a new instance passing in the common pieces that will be shared if multiple EntityManagerFactory instances are created.EntityManagerFactoryBuilder
(JpaVendorAdapter jpaVendorAdapter, Function<DataSource, Map<String, ?>> jpaPropertiesFactory, PersistenceUnitManager persistenceUnitManager, URL persistenceUnitRootLocation) Create a new instance passing in the common pieces that will be shared if multiple EntityManagerFactory instances are created.EntityManagerFactoryBuilder
(JpaVendorAdapter jpaVendorAdapter, Map<String, ?> jpaProperties, PersistenceUnitManager persistenceUnitManager) 已过时, 待删除: 此 API 元素将从以后的版本中删除。EntityManagerFactoryBuilder
(JpaVendorAdapter jpaVendorAdapter, Map<String, ?> jpaProperties, PersistenceUnitManager persistenceUnitManager, URL persistenceUnitRootLocation) 已过时, 待删除: 此 API 元素将从以后的版本中删除。since 3.4.4 for removal in 4.0.0 in favor ofEntityManagerFactoryBuilder(JpaVendorAdapter, Function, PersistenceUnitManager, URL)
-
方法概要
修饰符和类型方法说明dataSource
(DataSource dataSource) Create a newEntityManagerFactoryBuilder.Builder
for aEntityManagerFactory
using the settings of the given instance, and the givenDataSource
.void
setBootstrapExecutor
(AsyncTaskExecutor bootstrapExecutor) Configure the bootstrap executor to be used by theLocalContainerEntityManagerFactoryBean
.void
setPersistenceUnitPostProcessors
(PersistenceUnitPostProcessor... persistenceUnitPostProcessors) Set the persistence unit post processors to be applied to the PersistenceUnitInfo used for creating theLocalContainerEntityManagerFactoryBean
.
-
构造器详细资料
-
EntityManagerFactoryBuilder
public EntityManagerFactoryBuilder(JpaVendorAdapter jpaVendorAdapter, Function<DataSource, Map<String, ?>> jpaPropertiesFactory, PersistenceUnitManager persistenceUnitManager) Create a new instance passing in the common pieces that will be shared if multiple EntityManagerFactory instances are created.- 参数:
jpaVendorAdapter
- a vendor adapterjpaPropertiesFactory
- the JPA properties to be passed to the persistence provider, based on the configured data sourcepersistenceUnitManager
- optional source of persistence unit information (can be null)- 从以下版本开始:
- 3.4.4
-
EntityManagerFactoryBuilder
public EntityManagerFactoryBuilder(JpaVendorAdapter jpaVendorAdapter, Function<DataSource, Map<String, ?>> jpaPropertiesFactory, PersistenceUnitManager persistenceUnitManager, URL persistenceUnitRootLocation) Create a new instance passing in the common pieces that will be shared if multiple EntityManagerFactory instances are created.- 参数:
jpaVendorAdapter
- a vendor adapterjpaPropertiesFactory
- the JPA properties to be passed to the persistence provider, based on the configured data sourcepersistenceUnitManager
- optional source of persistence unit information (can be null)persistenceUnitRootLocation
- the persistence unit root location to use as a fallback ornull
- 从以下版本开始:
- 3.4.4
-
EntityManagerFactoryBuilder
@Deprecated(since="3.4.4", forRemoval=true) public EntityManagerFactoryBuilder(JpaVendorAdapter jpaVendorAdapter, Map<String, ?> jpaProperties, PersistenceUnitManager persistenceUnitManager) 已过时, 待删除: 此 API 元素将从以后的版本中删除。since 3.4.4 for removal in 4.0.0 in favor ofEntityManagerFactoryBuilder(JpaVendorAdapter, Function, PersistenceUnitManager)
Create a new instance passing in the common pieces that will be shared if multiple EntityManagerFactory instances are created.- 参数:
jpaVendorAdapter
- a vendor adapterjpaProperties
- the JPA properties to be passed to the persistence providerpersistenceUnitManager
- optional source of persistence unit information (can be null)
-
EntityManagerFactoryBuilder
@Deprecated(since="3.4.4", forRemoval=true) public EntityManagerFactoryBuilder(JpaVendorAdapter jpaVendorAdapter, Map<String, ?> jpaProperties, PersistenceUnitManager persistenceUnitManager, URL persistenceUnitRootLocation) 已过时, 待删除: 此 API 元素将从以后的版本中删除。since 3.4.4 for removal in 4.0.0 in favor ofEntityManagerFactoryBuilder(JpaVendorAdapter, Function, PersistenceUnitManager, URL)
Create a new instance passing in the common pieces that will be shared if multiple EntityManagerFactory instances are created.- 参数:
jpaVendorAdapter
- a vendor adapterjpaProperties
- the JPA properties to be passed to the persistence providerpersistenceUnitManager
- optional source of persistence unit information (can be null)persistenceUnitRootLocation
- the persistence unit root location to use as a fallback ornull
- 从以下版本开始:
- 1.4.1
-
-
方法详细资料
-
dataSource
Create a newEntityManagerFactoryBuilder.Builder
for aEntityManagerFactory
using the settings of the given instance, and the givenDataSource
.- 参数:
dataSource
- the data source to use- 返回:
- a builder to create an
EntityManagerFactory
-
setBootstrapExecutor
Configure the bootstrap executor to be used by theLocalContainerEntityManagerFactoryBean
.- 参数:
bootstrapExecutor
- the executor- 从以下版本开始:
- 2.1.0
-
setPersistenceUnitPostProcessors
public void setPersistenceUnitPostProcessors(PersistenceUnitPostProcessor... persistenceUnitPostProcessors) Set the persistence unit post processors to be applied to the PersistenceUnitInfo used for creating theLocalContainerEntityManagerFactoryBean
.- 参数:
persistenceUnitPostProcessors
- the persistence unit post processors to use- 从以下版本开始:
- 2.5.0
-
EntityManagerFactoryBuilder(JpaVendorAdapter, Function, PersistenceUnitManager)