Class EntityManagerFactoryBuilder.Builder

java.lang.Object
org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder.Builder
Enclosing class:
EntityManagerFactoryBuilder

public final class EntityManagerFactoryBuilder.Builder extends Object
A fluent builder for a LocalContainerEntityManagerFactoryBean.
  • Method Details

    • managedTypes

      The persistence managed types, providing both the managed entities and packages the entity manager should consider.
      Parameters:
      managedTypes - managed types.
      Returns:
      the builder for fluent usage
    • packages

      public EntityManagerFactoryBuilder.Builder packages(String... packagesToScan)
      The names of packages to scan for @Entity annotations.
      Parameters:
      packagesToScan - packages to scan
      Returns:
      the builder for fluent usage
      See Also:
    • packages

      public EntityManagerFactoryBuilder.Builder packages(Class<?>... basePackageClasses)
      The classes whose packages should be scanned for @Entity annotations.
      Parameters:
      basePackageClasses - the classes to use
      Returns:
      the builder for fluent usage
      See Also:
    • persistenceUnit

      public EntityManagerFactoryBuilder.Builder persistenceUnit(String persistenceUnit)
      The name of the persistence unit. If only building one EntityManagerFactory you can omit this, but if there are more than one in the same application you should give them distinct names.
      Parameters:
      persistenceUnit - the name of the persistence unit
      Returns:
      the builder for fluent usage
    • properties

      public EntityManagerFactoryBuilder.Builder properties(Map<String,?> properties)
      Generic properties for standard JPA or vendor-specific configuration. These properties override any values provided in the constructor.
      Parameters:
      properties - the properties to use
      Returns:
      the builder for fluent usage
    • mappingResources

      public EntityManagerFactoryBuilder.Builder mappingResources(String... mappingResources)
      The mapping resources (equivalent to <mapping-file> entries in persistence.xml) for the persistence unit.

      Note that mapping resources must be relative to the classpath root, e.g. "META-INF/mappings.xml" or "com/mycompany/repository/mappings.xml", so that they can be loaded through ClassLoader.getResource().

      Parameters:
      mappingResources - the mapping resources to use
      Returns:
      the builder for fluent usage
    • jta

      public EntityManagerFactoryBuilder.Builder jta(boolean jta)
      Configure if using a JTA DataSource, i.e. if setDataSource or setJtaDataSource should be called on the LocalContainerEntityManagerFactoryBean.
      Parameters:
      jta - if the data source is JTA
      Returns:
      the builder for fluent usage
    • build