Package org.hibernate.jpa.boot.spi
Interface EntityManagerFactoryBuilder
-
- All Known Implementing Classes:
EntityManagerFactoryBuilderImpl
public interface EntityManagerFactoryBuilder
Represents a two-phase JPA bootstrap process for building a HibernateEntityManagerFactory
.The first phase is the process of instantiating this builder. During the first phase, loading of Class references is highly discouraged.
The second phase is building the
EntityManagerFactory
instance viabuild()
.If anything goes wrong during either phase and the bootstrap process needs to be aborted,
cancel()
should be called.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description EntityManagerFactory
build()
BuildEntityManagerFactory
instancevoid
cancel()
Cancel the building processing.void
generateSchema()
Perform an explicit schema generation (rather than an "auto" one) based on theManagedResources
getManagedResources()
MetadataImplementor
metadata()
EntityManagerFactoryBuilder
withDataSource(DataSource dataSource)
Allows passing in a DataSource (delayed from constructing the builder, AKA phase 2) to be used in building the EntityManagerFactoryEntityManagerFactoryBuilder
withValidatorFactory(Object validatorFactory)
Allows passing in a Java EE ValidatorFactory (delayed from constructing the builder, AKA phase 2) to be used in building the EntityManagerFactory
-
-
-
Method Detail
-
getManagedResources
ManagedResources getManagedResources()
-
metadata
MetadataImplementor metadata()
-
withValidatorFactory
EntityManagerFactoryBuilder withValidatorFactory(Object validatorFactory)
Allows passing in a Java EE ValidatorFactory (delayed from constructing the builder, AKA phase 2) to be used in building the EntityManagerFactory- Parameters:
validatorFactory
- The ValidatorFactory- Returns:
this
, for method chaining
-
withDataSource
EntityManagerFactoryBuilder withDataSource(DataSource dataSource)
Allows passing in a DataSource (delayed from constructing the builder, AKA phase 2) to be used in building the EntityManagerFactory- Parameters:
dataSource
- The DataSource to use- Returns:
this
, for method chaining
-
build
EntityManagerFactory build()
BuildEntityManagerFactory
instance- Returns:
- The built
EntityManagerFactory
-
cancel
void cancel()
Cancel the building processing. This is used to signal the builder to release any resources in the case of something having gone wrong during the bootstrap process
-
generateSchema
void generateSchema()
Perform an explicit schema generation (rather than an "auto" one) based on the
-
-