Package org.hibernate.boot
Interface MetadataBuilder
-
- All Known Subinterfaces:
MetadataBuilderImplementor
- All Known Implementing Classes:
AbstractDelegatingMetadataBuilderImplementor
public interface MetadataBuilderContract for specifying various overrides to be used in metamodel building.- Since:
- 5.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description MetadataBuilderapplyAccessType(AccessType accessType)Specify the second-level access-type to be used by default for entities and collections that define second-level caching, but do not specify a granular access-type.MetadataBuilderapplyArchiveDescriptorFactory(ArchiveDescriptorFactory factory)Specify a particular ArchiveDescriptorFactory instance to use in scanning.MetadataBuilderapplyAttributeConverter(Class<? extends AttributeConverter> attributeConverterClass)Adds an AttributeConverter by its Class.MetadataBuilderapplyAttributeConverter(Class<? extends AttributeConverter> attributeConverterClass, boolean autoApply)Adds an AttributeConverter by its Class plus a boolean indicating whether to auto apply it.MetadataBuilderapplyAttributeConverter(AttributeConverter attributeConverter)Adds an AttributeConverter instance.MetadataBuilderapplyAttributeConverter(AttributeConverter attributeConverter, boolean autoApply)Adds an AttributeConverter instance, explicitly indicating whether to auto-apply.MetadataBuilderapplyAttributeConverter(AttributeConverterDefinition definition)Deprecated.(since 5.3) AttributeConverterDefinition forces early access to the AttributeConverter instance which precludes the possibility to resolve the converter from CDI, etc.MetadataBuilderapplyAuxiliaryDatabaseObject(AuxiliaryDatabaseObject auxiliaryDatabaseObject)MetadataBuilderapplyBasicType(BasicType type)Specify an additional or overridden basic type mapping.MetadataBuilderapplyBasicType(BasicType type, String... keys)Specify an additional or overridden basic type mapping supplying specific registration keys.MetadataBuilderapplyBasicType(CompositeUserType type, String... keys)Register an additional or overridden composite custom type mapping.MetadataBuilderapplyBasicType(UserType type, String... keys)Register an additional or overridden custom type mapping.MetadataBuilderapplyCacheRegionDefinition(CacheRegionDefinition cacheRegionDefinition)Apply a CacheRegionDefinition to be applied to an entity, collection or query while building the Metadata object.MetadataBuilderapplyIdGenerationTypeInterpreter(IdGeneratorStrategyInterpreter interpreter)MetadataBuilderapplyImplicitCatalogName(String implicitCatalogName)Specify the implicit catalog name to apply to any unqualified database names.MetadataBuilderapplyImplicitNamingStrategy(ImplicitNamingStrategy namingStrategy)Specify the ImplicitNamingStrategy to use in building the Metadata.MetadataBuilderapplyImplicitSchemaName(String implicitSchemaName)Specify the implicit schema name to apply to any unqualified database names.MetadataBuilderapplyIndexView(org.jboss.jandex.IndexView jandexView)Allows specifying a specific Jandex index to use for reading annotation information.MetadataBuilderapplyPhysicalNamingStrategy(PhysicalNamingStrategy namingStrategy)Specify the PhysicalNamingStrategy to use in building the Metadata.MetadataBuilderapplyScanEnvironment(ScanEnvironment scanEnvironment)Consider this temporary as discussed onScanEnvironmentMetadataBuilderapplyScanner(Scanner scanner)Specify a particular Scanner instance to use.MetadataBuilderapplyScanOptions(ScanOptions scanOptions)Specify the options to be used in performing scanning.MetadataBuilderapplySharedCacheMode(SharedCacheMode cacheMode)Specify the second-level cache mode to be used.MetadataBuilderapplySourceProcessOrdering(MetadataSourceType... sourceTypes)Apply a specific ordering to the processing of sources.MetadataBuilderapplySqlFunction(String functionName, SQLFunction function)MetadataBuilderapplyTempClassLoader(ClassLoader tempClassLoader)Apply a ClassLoader for use while building the Metadata.MetadataBuilderapplyTypes(TypeContributor typeContributor)Apply an explicit TypeContributor (implicit application via ServiceLoader will still happen too)Metadatabuild()Actually build the metamodelMetadataBuilderenableExplicitDiscriminatorsForJoinedSubclassSupport(boolean enabled)Should we process or ignore explicitly defined discriminators in the case of joined-subclasses.MetadataBuilderenableGlobalNationalizedCharacterDataSupport(boolean enabled)Should nationalized variants of character data be used in the database types? For example, shouldNVARCHARbe used instead ofVARCHAR?NCLOBinstead ofCLOB?MetadataBuilderenableImplicitDiscriminatorsForJoinedSubclassSupport(boolean enabled)Similarly toenableExplicitDiscriminatorsForJoinedSubclassSupport(boolean), but here how should we treat joined inheritance when there is no explicitly defined discriminator annotations? If enabled, we will handle joined inheritance with no explicit discriminator annotations by implicitly creating one (following the JPA implicit naming rules).MetadataBuilderenableImplicitForcingOfDiscriminatorsInSelect(boolean supported)For entities which do not explicitly say, should we force discriminators into SQL selects? The (historical) default isfalseMetadataBuilderenableNewIdentifierGeneratorSupport(boolean enable)Should we enable support for the "new" (since 3.2) identifier generator mappings for handling:GenerationType.SEQUENCEGenerationType.IDENTITYGenerationType.TABLEGenerationType.AUTO<T extends MetadataBuilder>
Tunwrap(Class<T> type)Allows unwrapping this builder as another, more specific type.
-
-
-
Method Detail
-
applyImplicitCatalogName
MetadataBuilder applyImplicitCatalogName(String implicitCatalogName)
Specify the implicit catalog name to apply to any unqualified database names. Its default is defined by theAvailableSettings.DEFAULT_CATALOGsetting if using property-based configuration.- Parameters:
implicitCatalogName- The implicit catalog name- Returns:
this, for method chaining- See Also:
AvailableSettings.DEFAULT_CATALOG
-
applyImplicitSchemaName
MetadataBuilder applyImplicitSchemaName(String implicitSchemaName)
Specify the implicit schema name to apply to any unqualified database names. Its default is defined by theAvailableSettings.DEFAULT_SCHEMAsetting if using property-based configuration.- Parameters:
implicitSchemaName- The implicit schema name- Returns:
this, for method chaining- See Also:
AvailableSettings.DEFAULT_SCHEMA
-
applyImplicitNamingStrategy
MetadataBuilder applyImplicitNamingStrategy(ImplicitNamingStrategy namingStrategy)
Specify the ImplicitNamingStrategy to use in building the Metadata. Its default is defined by theAvailableSettings.IMPLICIT_NAMING_STRATEGYsetting if using property-based configuration.- Parameters:
namingStrategy- The ImplicitNamingStrategy to apply- Returns:
this, for method chaining- See Also:
AvailableSettings.IMPLICIT_NAMING_STRATEGY
-
applyPhysicalNamingStrategy
MetadataBuilder applyPhysicalNamingStrategy(PhysicalNamingStrategy namingStrategy)
Specify the PhysicalNamingStrategy to use in building the Metadata. Its default is defined by theAvailableSettings.PHYSICAL_NAMING_STRATEGYsetting if using property-based configuration.- Parameters:
namingStrategy- The PhysicalNamingStrategy to apply- Returns:
this, for method chaining- See Also:
AvailableSettings.PHYSICAL_NAMING_STRATEGY
-
applySharedCacheMode
MetadataBuilder applySharedCacheMode(SharedCacheMode cacheMode)
Specify the second-level cache mode to be used. This is the cache mode in terms of whether or not to cache. Its default is defined by thejavax.persistence.sharedCache.modesetting if using property-based configuration.- Parameters:
cacheMode- The cache mode.- Returns:
this, for method chaining- See Also:
applyAccessType(org.hibernate.cache.spi.access.AccessType)
-
applyAccessType
MetadataBuilder applyAccessType(AccessType accessType)
Specify the second-level access-type to be used by default for entities and collections that define second-level caching, but do not specify a granular access-type. Its default is defined by theAvailableSettings.DEFAULT_CACHE_CONCURRENCY_STRATEGYsetting if using property-based configuration.- Parameters:
accessType- The access-type to use as default.- Returns:
this, for method chaining- See Also:
AvailableSettings.DEFAULT_CACHE_CONCURRENCY_STRATEGY,applySharedCacheMode(javax.persistence.SharedCacheMode)
-
applyIndexView
MetadataBuilder applyIndexView(org.jboss.jandex.IndexView jandexView)
Allows specifying a specific Jandex index to use for reading annotation information. It is important to understand that if a Jandex index is passed in, it is expected that this Jandex index already contains all entries for all classes. No additional indexing will be done in this case. NOTE : Here for future expansion. At the moment the passed Jandex index is not used.- Parameters:
jandexView- The Jandex index to use.- Returns:
this, for method chaining
-
applyScanOptions
MetadataBuilder applyScanOptions(ScanOptions scanOptions)
Specify the options to be used in performing scanning.- Parameters:
scanOptions- The scan options.- Returns:
this, for method chaining- See Also:
AvailableSettings.SCANNER_DISCOVERY
-
applyScanEnvironment
MetadataBuilder applyScanEnvironment(ScanEnvironment scanEnvironment)
Consider this temporary as discussed onScanEnvironment- Parameters:
scanEnvironment- The environment for scanning- Returns:
this, for method chaining
-
applyScanner
MetadataBuilder applyScanner(Scanner scanner)
Specify a particular Scanner instance to use. Its default is defined by theAvailableSettings.SCANNERsetting if using property-based configuration.- Parameters:
scanner- The scanner to use.- Returns:
this, for method chaining- See Also:
AvailableSettings.SCANNER
-
applyArchiveDescriptorFactory
MetadataBuilder applyArchiveDescriptorFactory(ArchiveDescriptorFactory factory)
Specify a particular ArchiveDescriptorFactory instance to use in scanning. Its default is defined by theAvailableSettings.SCANNER_ARCHIVE_INTERPRETERsetting if using property-based configuration.- Parameters:
factory- The ArchiveDescriptorFactory to use.- Returns:
this, for method chaining- See Also:
AvailableSettings.SCANNER_ARCHIVE_INTERPRETER
-
enableNewIdentifierGeneratorSupport
MetadataBuilder enableNewIdentifierGeneratorSupport(boolean enable)
Should we enable support for the "new" (since 3.2) identifier generator mappings for handling: Its default is defined by theAvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGSsetting if using property-based configuration.- Parameters:
enable-trueto enable;falseto disable; don't call for default.- Returns:
this, for method chaining- See Also:
AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS
-
enableExplicitDiscriminatorsForJoinedSubclassSupport
MetadataBuilder enableExplicitDiscriminatorsForJoinedSubclassSupport(boolean enabled)
Should we process or ignore explicitly defined discriminators in the case of joined-subclasses. The legacy behavior of Hibernate was to ignore the discriminator annotations because Hibernate (unlike some providers) does not need discriminators to determine the concrete type when it comes to joined inheritance. However, for portability reasons we do now allow using explicit discriminators along with joined inheritance. It is configurable though to support legacy apps. Its default is defined by theAvailableSettings.IGNORE_EXPLICIT_DISCRIMINATOR_COLUMNS_FOR_JOINED_SUBCLASSsetting if using property-based configuration.- Parameters:
enabled- Should processing (not ignoring) explicit discriminators be enabled?- Returns:
this, for method chaining- See Also:
AvailableSettings.IGNORE_EXPLICIT_DISCRIMINATOR_COLUMNS_FOR_JOINED_SUBCLASS
-
enableImplicitDiscriminatorsForJoinedSubclassSupport
MetadataBuilder enableImplicitDiscriminatorsForJoinedSubclassSupport(boolean enabled)
Similarly toenableExplicitDiscriminatorsForJoinedSubclassSupport(boolean), but here how should we treat joined inheritance when there is no explicitly defined discriminator annotations? If enabled, we will handle joined inheritance with no explicit discriminator annotations by implicitly creating one (following the JPA implicit naming rules). Again the premise here is JPA portability, bearing in mind that some JPA provider need these discriminators. Its default is defined by theAvailableSettings.IMPLICIT_DISCRIMINATOR_COLUMNS_FOR_JOINED_SUBCLASSsetting if using property-based configuration.- Parameters:
enabled- Should we implicitly create discriminator for joined inheritance if one is not explicitly mentioned?- Returns:
this, for method chaining- See Also:
AvailableSettings.IMPLICIT_DISCRIMINATOR_COLUMNS_FOR_JOINED_SUBCLASS
-
enableImplicitForcingOfDiscriminatorsInSelect
MetadataBuilder enableImplicitForcingOfDiscriminatorsInSelect(boolean supported)
For entities which do not explicitly say, should we force discriminators into SQL selects? The (historical) default isfalseIts default is defined by theAvailableSettings.FORCE_DISCRIMINATOR_IN_SELECTS_BY_DEFAULTsetting if using property-based configuration.- Parameters:
supported-trueindicates we will force the discriminator into the select;falseindicates we will not.- Returns:
this, for method chaining- See Also:
AvailableSettings.FORCE_DISCRIMINATOR_IN_SELECTS_BY_DEFAULT
-
enableGlobalNationalizedCharacterDataSupport
MetadataBuilder enableGlobalNationalizedCharacterDataSupport(boolean enabled)
Should nationalized variants of character data be used in the database types? For example, shouldNVARCHARbe used instead ofVARCHAR?NCLOBinstead ofCLOB? Its default is defined by theAvailableSettings.USE_NATIONALIZED_CHARACTER_DATAsetting if using property-based configuration.- Parameters:
enabled-truesays to use nationalized variants;falsesays to use the non-nationalized variants.- Returns:
this, for method chaining- See Also:
AvailableSettings.USE_NATIONALIZED_CHARACTER_DATA
-
applyBasicType
MetadataBuilder applyBasicType(BasicType type)
Specify an additional or overridden basic type mapping.- Parameters:
type- The type addition or override.- Returns:
this, for method chaining
-
applyBasicType
MetadataBuilder applyBasicType(BasicType type, String... keys)
Specify an additional or overridden basic type mapping supplying specific registration keys.- Parameters:
type- The type addition or override.keys- The keys under which to register the basic type.- Returns:
this, for method chaining
-
applyBasicType
MetadataBuilder applyBasicType(UserType type, String... keys)
Register an additional or overridden custom type mapping.- Parameters:
type- The custom typekeys- The keys under which to register the custom type.- Returns:
this, for method chaining
-
applyBasicType
MetadataBuilder applyBasicType(CompositeUserType type, String... keys)
Register an additional or overridden composite custom type mapping.- Parameters:
type- The composite custom typekeys- The keys under which to register the composite custom type.- Returns:
this, for method chaining
-
applyTypes
MetadataBuilder applyTypes(TypeContributor typeContributor)
Apply an explicit TypeContributor (implicit application via ServiceLoader will still happen too)- Parameters:
typeContributor- The contributor to apply- Returns:
this, for method chaining
-
applyCacheRegionDefinition
MetadataBuilder applyCacheRegionDefinition(CacheRegionDefinition cacheRegionDefinition)
Apply a CacheRegionDefinition to be applied to an entity, collection or query while building the Metadata object.- Parameters:
cacheRegionDefinition- The cache region definition to apply- Returns:
this, for method chaining
-
applyTempClassLoader
MetadataBuilder applyTempClassLoader(ClassLoader tempClassLoader)
Apply a ClassLoader for use while building the Metadata. Ideally we should avoid accessing ClassLoaders when perform 1st phase of bootstrap. This is a ClassLoader that can be used in cases when we have to. IN EE managed environments, this is the ClassLoader mandated byPersistenceUnitInfo.getNewTempClassLoader(). This ClassLoader is thrown away by the container afterwards. The idea being that the Class can still be enhanced in the application ClassLoader. In other environments, pass a ClassLoader that performs the same function if desired.- Parameters:
tempClassLoader- ClassLoader for use during building the Metadata- Returns:
this, for method chaining
-
applySourceProcessOrdering
MetadataBuilder applySourceProcessOrdering(MetadataSourceType... sourceTypes)
Apply a specific ordering to the processing of sources. Note that unlike most of the methods on this contract that deal with multiple values internally, this one *replaces* any already set (its more a setter) instead of adding to. Its default is defined by theAvailableSettings.ARTIFACT_PROCESSING_ORDERsetting if using property-based configuration.- Parameters:
sourceTypes- The types, in the order they should be processed- Returns:
thisfor method chaining- See Also:
AvailableSettings.ARTIFACT_PROCESSING_ORDER
-
applySqlFunction
MetadataBuilder applySqlFunction(String functionName, SQLFunction function)
-
applyAuxiliaryDatabaseObject
MetadataBuilder applyAuxiliaryDatabaseObject(AuxiliaryDatabaseObject auxiliaryDatabaseObject)
-
applyAttributeConverter
@Deprecated MetadataBuilder applyAttributeConverter(AttributeConverterDefinition definition)
Deprecated.(since 5.3) AttributeConverterDefinition forces early access to the AttributeConverter instance which precludes the possibility to resolve the converter from CDI, etc. Instead use one of: *applyAttributeConverter(Class)*applyAttributeConverter(Class, boolean)*applyAttributeConverter(AttributeConverter)*applyAttributeConverter(AttributeConverter, boolean)Adds an AttributeConverter by an AttributeConverterDefinition- Parameters:
definition- The definition- Returns:
thisfor method chaining
-
applyAttributeConverter
MetadataBuilder applyAttributeConverter(Class<? extends AttributeConverter> attributeConverterClass)
Adds an AttributeConverter by its Class.- Parameters:
attributeConverterClass- The AttributeConverter class.- Returns:
thisfor method chaining
-
applyAttributeConverter
MetadataBuilder applyAttributeConverter(Class<? extends AttributeConverter> attributeConverterClass, boolean autoApply)
Adds an AttributeConverter by its Class plus a boolean indicating whether to auto apply it.- Parameters:
attributeConverterClass- The AttributeConverter class.autoApply- Should the AttributeConverter be auto applied to property types as specified by its "entity attribute" parameterized type?- Returns:
thisfor method chaining- See Also:
AttributeConverterDefinition.from(Class, boolean)
-
applyAttributeConverter
MetadataBuilder applyAttributeConverter(AttributeConverter attributeConverter)
Adds an AttributeConverter instance.- Parameters:
attributeConverter- The AttributeConverter instance.- Returns:
thisfor method chaining- See Also:
AttributeConverterDefinition.from(AttributeConverter)
-
applyAttributeConverter
MetadataBuilder applyAttributeConverter(AttributeConverter attributeConverter, boolean autoApply)
Adds an AttributeConverter instance, explicitly indicating whether to auto-apply.- Parameters:
attributeConverter- The AttributeConverter instance.autoApply- Should the AttributeConverter be auto applied to property types as specified by its "entity attribute" parameterized type?- Returns:
thisfor method chaining- See Also:
AttributeConverterDefinition.from(AttributeConverter, boolean)
-
applyIdGenerationTypeInterpreter
MetadataBuilder applyIdGenerationTypeInterpreter(IdGeneratorStrategyInterpreter interpreter)
-
unwrap
<T extends MetadataBuilder> T unwrap(Class<T> type)
Allows unwrapping this builder as another, more specific type.- Type Parameters:
T-- Parameters:
type-- Returns:
- The unwrapped builder.
-
build
Metadata build()
Actually build the metamodel- Returns:
- The built metadata.
-
-