org.springframework.boot.orm.jpa

Class EntityManagerFactoryBuilder

  • java.lang.Object
    • org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder


  • public class EntityManagerFactoryBuilder
    extends java.lang.Object
    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
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class and Description
      class  EntityManagerFactoryBuilder.Builder
      A fluent builder for a LocalContainerEntityManagerFactoryBean.
    • Constructor Summary

      Constructors 
      Constructor and Description
      EntityManagerFactoryBuilder(org.springframework.orm.jpa.JpaVendorAdapter jpaVendorAdapter, java.util.Map<java.lang.String,?> jpaProperties, org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager persistenceUnitManager)
      Create a new instance passing in the common pieces that will be shared if multiple EntityManagerFactory instances are created.
      EntityManagerFactoryBuilder(org.springframework.orm.jpa.JpaVendorAdapter jpaVendorAdapter, java.util.Map<java.lang.String,?> jpaProperties, org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager persistenceUnitManager, java.net.URL persistenceUnitRootLocation)
      Create a new instance passing in the common pieces that will be shared if multiple EntityManagerFactory instances are created.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      EntityManagerFactoryBuilder.Builder dataSource(javax.sql.DataSource dataSource) 
      void setBootstrapExecutor(org.springframework.core.task.AsyncTaskExecutor bootstrapExecutor)
      Configure the bootstrap executor to be used by the LocalContainerEntityManagerFactoryBean.
      void setPersistenceUnitPostProcessors(org.springframework.orm.jpa.persistenceunit.PersistenceUnitPostProcessor... persistenceUnitPostProcessors)
      Set the persistence unit post processors to be applied to the PersistenceUnitInfo used for creating the LocalContainerEntityManagerFactoryBean.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EntityManagerFactoryBuilder

        public EntityManagerFactoryBuilder(org.springframework.orm.jpa.JpaVendorAdapter jpaVendorAdapter,
                                           java.util.Map<java.lang.String,?> jpaProperties,
                                           org.springframework.orm.jpa.persistenceunit.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
        jpaProperties - the JPA properties to be passed to the persistence provider
        persistenceUnitManager - optional source of persistence unit information (can be null)
      • EntityManagerFactoryBuilder

        public EntityManagerFactoryBuilder(org.springframework.orm.jpa.JpaVendorAdapter jpaVendorAdapter,
                                           java.util.Map<java.lang.String,?> jpaProperties,
                                           org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager persistenceUnitManager,
                                           java.net.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
        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 Detail

      • setBootstrapExecutor

        public void setBootstrapExecutor(org.springframework.core.task.AsyncTaskExecutor bootstrapExecutor)
        Configure the bootstrap executor to be used by the LocalContainerEntityManagerFactoryBean.
        Parameters:
        bootstrapExecutor - the executor
        Since:
        2.1.0
      • setPersistenceUnitPostProcessors

        public void setPersistenceUnitPostProcessors(org.springframework.orm.jpa.persistenceunit.PersistenceUnitPostProcessor... persistenceUnitPostProcessors)
        Set the persistence unit post processors to be applied to the PersistenceUnitInfo used for creating the LocalContainerEntityManagerFactoryBean.
        Parameters:
        persistenceUnitPostProcessors - the persistence unit post processors to use
        Since:
        2.5.0