Package org.springframework.boot.orm.jpa
Class EntityManagerFactoryBuilder.Builder
java.lang.Object
org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder.Builder
- Enclosing class:
- EntityManagerFactoryBuilder
A fluent builder for a LocalContainerEntityManagerFactoryBean.
-
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
build()
jta
(boolean jta) Configure if using a JTADataSource
, i.e.managedTypes
(org.springframework.orm.jpa.persistenceunit.PersistenceManagedTypes managedTypes) The persistence managed types, providing both the managed entities and packages the entity manager should consider.mappingResources
(String... mappingResources) The mapping resources (equivalent to<mapping-file>
entries inpersistence.xml
) for the persistence unit.The classes whose packages should be scanned for@Entity
annotations.The names of packages to scan for@Entity
annotations.persistenceUnit
(String persistenceUnit) The name of the persistence unit.properties
(Map<String, ?> properties) Generic properties for standard JPA or vendor-specific configuration.
-
Method Details
-
managedTypes
public EntityManagerFactoryBuilder.Builder managedTypes(org.springframework.orm.jpa.persistenceunit.PersistenceManagedTypes 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
The names of packages to scan for@Entity
annotations.- Parameters:
packagesToScan
- packages to scan- Returns:
- the builder for fluent usage
- See Also:
-
packages
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
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
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
The mapping resources (equivalent to<mapping-file>
entries inpersistence.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
Configure if using a JTADataSource
, i.e. ifsetDataSource
orsetJtaDataSource
should be called on theLocalContainerEntityManagerFactoryBean
.- Parameters:
jta
- if the data source is JTA- Returns:
- the builder for fluent usage
-
build
public org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean build()
-