Package org.springframework.boot.orm.jpa
Class 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.- Since:
- 1.3.0
- Author:
- Dave Syer, Phillip Webb, Stephane Nicoll
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionfinal classA fluent builder for a LocalContainerEntityManagerFactoryBean.
- 
Constructor SummaryConstructorsConstructorDescriptionEntityManagerFactoryBuilder(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) Deprecated, for removal: This API element is subject to removal in a future version.EntityManagerFactoryBuilder(JpaVendorAdapter jpaVendorAdapter, Map<String, ?> jpaProperties, PersistenceUnitManager persistenceUnitManager, URL persistenceUnitRootLocation) Deprecated, for removal: This API element is subject to removal in a future version.since 3.4.4 for removal in 4.0.0 in favor ofEntityManagerFactoryBuilder(JpaVendorAdapter, Function, PersistenceUnitManager, URL)
- 
Method SummaryModifier and TypeMethodDescriptiondataSource(DataSource dataSource) Create a newEntityManagerFactoryBuilder.Builderfor aEntityManagerFactoryusing the settings of the given instance, and the givenDataSource.voidsetBootstrapExecutor(AsyncTaskExecutor bootstrapExecutor) Configure the bootstrap executor to be used by theLocalContainerEntityManagerFactoryBean.voidsetPersistenceUnitPostProcessors(PersistenceUnitPostProcessor... persistenceUnitPostProcessors) Set the persistence unit post processors to be applied to the PersistenceUnitInfo used for creating theLocalContainerEntityManagerFactoryBean.
- 
Constructor Details- 
EntityManagerFactoryBuilderpublic 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.- Parameters:
- jpaVendorAdapter- a vendor adapter
- jpaPropertiesFactory- the JPA properties to be passed to the persistence provider, based on the configured data source
- persistenceUnitManager- optional source of persistence unit information (can be null)
- Since:
- 3.4.4
 
- 
EntityManagerFactoryBuilderpublic 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.- Parameters:
- jpaVendorAdapter- a vendor adapter
- jpaPropertiesFactory- the JPA properties to be passed to the persistence provider, based on the configured data source
- persistenceUnitManager- optional source of persistence unit information (can be null)
- persistenceUnitRootLocation- the persistence unit root location to use as a fallback or- null
- Since:
- 3.4.4
 
- 
EntityManagerFactoryBuilder@Deprecated(since="3.4.4", forRemoval=true) public EntityManagerFactoryBuilder(JpaVendorAdapter jpaVendorAdapter, Map<String, ?> jpaProperties, PersistenceUnitManager persistenceUnitManager) Deprecated, for removal: This API element is subject to removal in a future version.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.- Parameters:
- jpaVendorAdapter- a vendor adapter
- jpaProperties- the JPA properties to be passed to the persistence provider
- persistenceUnitManager- 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) Deprecated, for removal: This API element is subject to removal in a future version.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.- Parameters:
- jpaVendorAdapter- a vendor adapter
- jpaProperties- the JPA properties to be passed to the persistence provider
- persistenceUnitManager- optional source of persistence unit information (can be null)
- persistenceUnitRootLocation- the persistence unit root location to use as a fallback or- null
- Since:
- 1.4.1
 
 
- 
- 
Method Details- 
dataSourceCreate a newEntityManagerFactoryBuilder.Builderfor aEntityManagerFactoryusing the settings of the given instance, and the givenDataSource.- Parameters:
- dataSource- the data source to use
- Returns:
- a builder to create an EntityManagerFactory
 
- 
setBootstrapExecutorConfigure the bootstrap executor to be used by theLocalContainerEntityManagerFactoryBean.- Parameters:
- bootstrapExecutor- the executor
- Since:
- 2.1.0
 
- 
setPersistenceUnitPostProcessorspublic void setPersistenceUnitPostProcessors(PersistenceUnitPostProcessor... persistenceUnitPostProcessors) Set the persistence unit post processors to be applied to the PersistenceUnitInfo used for creating theLocalContainerEntityManagerFactoryBean.- Parameters:
- persistenceUnitPostProcessors- the persistence unit post processors to use
- Since:
- 2.5.0
 
 
- 
EntityManagerFactoryBuilder(JpaVendorAdapter, Function, PersistenceUnitManager)