introduce JpaSettings and improve docs of org.hibernate.jpa.boot

This commit is contained in:
Gavin 2022-12-29 23:58:24 +01:00 committed by Gavin King
parent d6be936da3
commit fc6db246a8
7 changed files with 66 additions and 8 deletions

View File

@ -64,6 +64,7 @@ import org.hibernate.internal.util.StringHelper;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.jpa.boot.spi.EntityManagerFactoryBuilder;
import org.hibernate.jpa.boot.spi.IntegratorProvider;
import org.hibernate.jpa.boot.spi.JpaSettings;
import org.hibernate.jpa.boot.spi.PersistenceUnitDescriptor;
import org.hibernate.jpa.boot.spi.StrategyRegistrationProviderList;
import org.hibernate.jpa.boot.spi.TypeContributorList;
@ -140,22 +141,22 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil
/**
* Names a {@link IntegratorProvider}
*/
public static final String INTEGRATOR_PROVIDER = "hibernate.integrator_provider";
public static final String INTEGRATOR_PROVIDER = JpaSettings.INTEGRATOR_PROVIDER;
/**
* Names a {@link StrategyRegistrationProviderList}
*/
public static final String STRATEGY_REGISTRATION_PROVIDERS = "hibernate.strategy_registration_provider";
public static final String STRATEGY_REGISTRATION_PROVIDERS = JpaSettings.STRATEGY_REGISTRATION_PROVIDERS;
/**
* Names a {@link TypeContributorList}
*/
public static final String TYPE_CONTRIBUTORS = "hibernate.type_contributors";
public static final String TYPE_CONTRIBUTORS = JpaSettings.TYPE_CONTRIBUTORS;
/**
* Names a {@link MetadataBuilderImplementor}
* Names a {@link MetadataBuilderContributor}
*/
public static final String METADATA_BUILDER_CONTRIBUTOR = "hibernate.metadata_builder_contributor";
public static final String METADATA_BUILDER_CONTRIBUTOR = JpaSettings.METADATA_BUILDER_CONTRIBUTOR;
/**
* Names a Jandex {@link Index} instance to use.

View File

@ -11,6 +11,11 @@ import java.util.List;
import org.hibernate.integrator.spi.Integrator;
/**
* An object that provides a list of {@link Integrator}s to the JPA persistence provider.
* <p>
* In implementation may be registered with the JPA provider using the property
* {@value org.hibernate.jpa.boot.spi.JpaSettings#INTEGRATOR_PROVIDER}.
*
* @author Steve Ebersole
*/
public interface IntegratorProvider {

View File

@ -0,0 +1,41 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.jpa.boot.spi;
import org.hibernate.boot.spi.MetadataBuilderContributor;
/**
* Enumerates SPI-related settings that are specific to the use of Hibernate
* as a JPA {@link jakarta.persistence.spi.PersistenceProvider}.
*
* @author Gavin King
*
* @since 6.2
*/
public class JpaSettings {
/**
* Names a {@link IntegratorProvider}
*/
public static final String INTEGRATOR_PROVIDER = "hibernate.integrator_provider";
/**
* Names a {@link StrategyRegistrationProviderList}
*/
public static final String STRATEGY_REGISTRATION_PROVIDERS = "hibernate.strategy_registration_provider";
/**
* Names a {@link TypeContributorList}
*/
public static final String TYPE_CONTRIBUTORS = "hibernate.type_contributors";
/**
* Names a {@link MetadataBuilderContributor}
*/
public static final String METADATA_BUILDER_CONTRIBUTOR = "hibernate.metadata_builder_contributor";
}

View File

@ -11,6 +11,11 @@ import java.util.List;
import org.hibernate.boot.registry.selector.StrategyRegistrationProvider;
/**
* An object that provides a list of {@link StrategyRegistrationProvider}s to the JPA persistence provider.
* <p>
* In implementation may be registered with the JPA provider using the property
* {@value org.hibernate.jpa.boot.spi.JpaSettings#STRATEGY_REGISTRATION_PROVIDERS}.
*
* @author Brett Meyer
*/
// TODO: Not a fan of this name or entry point into EMFBuilderImpl

View File

@ -11,6 +11,11 @@ import java.util.List;
import org.hibernate.boot.model.TypeContributor;
/**
* An object that provides a list of {@link TypeContributor}s to the JPA persistence provider.
* <p>
* In implementation may be registered with the JPA provider using the property
* {@value org.hibernate.jpa.boot.spi.JpaSettings#TYPE_CONTRIBUTORS}.
*
* @author Brett Meyer
*/
// TODO: Not a fan of this name or entry point into EMFBuilderImpl

View File

@ -6,8 +6,8 @@
*/
/**
* An SPI for bootstrapping a Jakarta Persistence
* {@link jakarta.persistence.EntityManagerFactory}
* An SPI controlling and integrating with the bootstrap process for the
* Jakarta Persistence {@link jakarta.persistence.EntityManagerFactory}.
*
* @author Steve Ebersole
*/

View File

@ -23,7 +23,8 @@
* <p>
* Concerns handled by subpackages include:
* <ul>
* <li>{@linkplain org.hibernate.jpa.boot.spi bootstrapping} JPA,
* <li>{@linkplain org.hibernate.jpa.boot.spi bootstrapping} JPA and
* integrating with the bootstrap process,
* <li>calling JPA {@linkplain org.hibernate.jpa.event.spi event listeners},
* and
* <li>managing cases where Hibernate intentionally