Package org.hibernate.boot.model.naming
Class ObjectNameNormalizer
java.lang.Object
org.hibernate.boot.model.naming.ObjectNameNormalizer
Provides centralized normalization of how database object names are handled.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapplyGlobalQuoting(String text) Intended only for use in handling quoting requirements forcolumn-definitionas defined byColumn.columnDefinition(),JoinColumn.columnDefinition(), etc.protected Databasedatabase()determineLogicalName(String explicitName, NamingStrategyHelper namingStrategyHelper) Determine the logical name give a (potentiallynull/empty) explicit name.protected MetadataBuildingContextAccess the contextual information related to the current process of building metadata.normalizeIdentifierQuoting(String identifierText) Normalizes the quoting of identifiers.normalizeIdentifierQuoting(Identifier identifier) normalizeIdentifierQuotingAsString(String identifierText) Normalizes the quoting of identifiers.toDatabaseIdentifierText(String identifierText)
-
Constructor Details
-
ObjectNameNormalizer
-
-
Method Details
-
normalizeIdentifierQuoting
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- The identifier to be quoting-normalized.- Returns:
- The identifier accounting for any quoting that need be applied.
-
database
-
normalizeIdentifierQuoting
-
normalizeIdentifierQuotingAsString
Normalizes the quoting of identifiers. This form returns a String rather than an Identifier to better work with the legacy code inorg.hibernate.mapping- Parameters:
identifierText- The identifier to be quoting-normalized.- Returns:
- The identifier accounting for any quoting that need be applied.
-
toDatabaseIdentifierText
-
determineLogicalName
public Identifier determineLogicalName(String explicitName, NamingStrategyHelper namingStrategyHelper) Determine the logical name give a (potentiallynull/empty) explicit name.- Parameters:
explicitName- The explicit, user-supplied namenamingStrategyHelper- The naming strategy helper.- Returns:
- The logical name
-
applyGlobalQuoting
Intended only for use in handling quoting requirements forcolumn-definitionas defined byColumn.columnDefinition(),JoinColumn.columnDefinition(), etc. This method should not be called in any other scenario.- Parameters:
text- The specified column definition- Returns:
- The name with global quoting applied
-
getBuildingContext
Access the contextual information related to the current process of building metadata. Here, that typically might be needed for accessing:- Returns:
- The current building context
-