Top Description Fields Constructors Methods
org.hibernate.boot.model.naming

public abstract Class ObjectNameNormalizer

extends Object
Class Inheritance
Imports
org.hibernate.boot.model.relational.Database, org.hibernate.boot.spi.MetadataBuildingContext, org.hibernate.internal.util.StringHelper

Provides centralized normalization of how database object names are handled.
Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
private Database

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

The name with global quoting applied
applyGlobalQuoting
(String
The specified column definition
text
)

Intended only for use in handling quoting requirements for column-definition as defined by jakarta.persistence.Column#columnDefinition(), jakarta.persistence.JoinColumn#columnDefinition, etc. This method should not be called in any other scenario.

protected Database
public Identifier

Returns:

The logical name
determineLogicalName
(String
The explicit, user-supplied name
explicitName
,
NamingStrategyHelper
The naming strategy helper.
namingStrategyHelper
)

Determine the logical name give a (potentially null/empty) explicit name.

protected abstract MetadataBuildingContext

Returns:

The current building context
getBuildingContext
()

Access the contextual information related to the current process of building metadata.

public Identifier

Returns:

The identifier accounting for any quoting that need be applied.
normalizeIdentifierQuoting
(String
The identifier to be quoting-normalized.
identifierText
)

Normalizes the quoting of identifiers.

public Identifier
public String

Returns:

The identifier accounting for any quoting that need be applied.
normalizeIdentifierQuotingAsString
(String
The identifier to be quoting-normalized.
identifierText
)

Normalizes the quoting of identifiers.

public String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

databaseback to summary
private Database database

Constructor Detail

ObjectNameNormalizerback to summary
public ObjectNameNormalizer()

Method Detail

applyGlobalQuotingback to summary
public String applyGlobalQuoting(String text)

Intended only for use in handling quoting requirements for column-definition as defined by jakarta.persistence.Column#columnDefinition(), jakarta.persistence.JoinColumn#columnDefinition, etc. This method should not be called in any other scenario.

Parameters
text:String

The specified column definition

Returns:String

The name with global quoting applied

databaseback to summary
protected Database database()
determineLogicalNameback to summary
public Identifier determineLogicalName(String explicitName, NamingStrategyHelper namingStrategyHelper)

Determine the logical name give a (potentially null/empty) explicit name.

Parameters
explicitName:String

The explicit, user-supplied name

namingStrategyHelper:NamingStrategyHelper

The naming strategy helper.

Returns:Identifier

The logical name

getBuildingContextback to summary
protected abstract MetadataBuildingContext getBuildingContext()

Access the contextual information related to the current process of building metadata. Here, that typically might be needed for accessing:

Returns:MetadataBuildingContext

The current building context

normalizeIdentifierQuotingback to summary
public Identifier normalizeIdentifierQuoting(String identifierText)

Normalizes the quoting of identifiers.

This implements the rules set forth in JPA 2 (section "2.13 Naming of Database Objects") which states that the double-quote (") is the character which should be used to denote a quoted identifier. Here, we handle recognizing that and converting it to the more elegant backtick (`) approach used in Hibernate. Additionally, we account for applying what JPA2 terms "globally quoted identifiers".

Parameters
identifierText:String

The identifier to be quoting-normalized.

Returns:Identifier

The identifier accounting for any quoting that need be applied.

normalizeIdentifierQuotingback to summary
public Identifier normalizeIdentifierQuoting(Identifier identifier)
normalizeIdentifierQuotingAsStringback to summary
public String normalizeIdentifierQuotingAsString(String identifierText)

Normalizes the quoting of identifiers. This form returns a String rather than an Identifier to better work with the legacy code in org.hibernate.mapping

Parameters
identifierText:String

The identifier to be quoting-normalized.

Returns:String

The identifier accounting for any quoting that need be applied.

toDatabaseIdentifierTextback to summary
public String toDatabaseIdentifierText(String identifierText)