Top Description Methods
org.hibernate.jpa.boot.spi

public Interface EntityManagerFactoryBuilder

Known Direct Implementers
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl
Imports
jakarta.persistence.EntityManagerFactory, javax.sql.DataSource, org.hibernate.boot.model.process.spi.ManagedResources, org.hibernate.boot.spi.MetadataImplementor

Represents a two-phase JPA bootstrap process for building a Hibernate EntityManagerFactory.

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 via build.

If anything goes wrong during either phase and the bootstrap process needs to be aborted, cancel() should be called.

Authors
Steve Ebersole, Scott Marlow

Method Summary

Modifier and TypeMethod and Description
public EntityManagerFactory

Returns:

The built EntityManagerFactory
build
()

Build EntityManagerFactory instance

public void
cancel()

Cancel the building processing.

public void
generateSchema()

Perform an explicit schema generation (rather than an "auto" one) based on the

public ManagedResources
public MetadataImplementor
metadata()

Deprecated as a consequence of MetadataImplementor being deprecated.
public EntityManagerFactoryBuilder

Returns:

this, for method chaining
withDataSource
(DataSource
The DataSource to use
dataSource
)

Allows passing in a DataSource (delayed from constructing the builder, AKA phase 2) to be used in building the EntityManagerFactory

public EntityManagerFactoryBuilder

Returns:

this, for method chaining
withValidatorFactory
(Object
The ValidatorFactory
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

buildback to summary
public EntityManagerFactory build()

Build EntityManagerFactory instance

Returns:EntityManagerFactory

The built EntityManagerFactory

cancelback to summary
public 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

generateSchemaback to summary
public void generateSchema()

Perform an explicit schema generation (rather than an "auto" one) based on the

getManagedResourcesback to summary
public ManagedResources getManagedResources()
metadataback to summary
public MetadataImplementor metadata()

Deprecated

as a consequence of MetadataImplementor being deprecated. See corresponding docs for further information.

withDataSourceback to summary
public 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:DataSource

The DataSource to use

Returns:EntityManagerFactoryBuilder

this, for method chaining

withValidatorFactoryback to summary
public 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:Object

The ValidatorFactory

Returns:EntityManagerFactoryBuilder

this, for method chaining