Package org.hibernate.cfg
Class ObjectNameNormalizer
java.lang.Object
org.hibernate.cfg.ObjectNameNormalizer
Provides centralized normalization of how database object names are handled.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceHelper contract for dealing withNamingStrategyin different situations. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract NamingStrategyGet the currentNamingStrategy.protected abstract booleanRetrieve whether the user requested that all database identifiers be quoted.normalizeDatabaseIdentifier(String explicitName, ObjectNameNormalizer.NamingStrategyHelper helper) Performs the actual contract of normalizing a database name.normalizeIdentifierQuoting(String identifier) Allow normalizing of just the quoting aspect of identifiers.
-
Constructor Details
-
ObjectNameNormalizer
public ObjectNameNormalizer()
-
-
Method Details
-
normalizeDatabaseIdentifier
public String normalizeDatabaseIdentifier(String explicitName, ObjectNameNormalizer.NamingStrategyHelper helper) Performs the actual contract of normalizing a database name.- Parameters:
explicitName- The name the user explicitly gave for the database object.helper- TheNamingStrategyhelper.- Returns:
- The normalized identifier.
-
normalizeIdentifierQuoting
Allow normalizing of just the quoting aspect of identifiers. This is useful for schema and catalog in terms of initially making this public. 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 bactick (`) approach used in Hibernate.. Additionally we account for applying what JPA2 terms- Parameters:
identifier- The identifier to be quoting-normalized.- Returns:
- The identifier accounting for any quoting that need be applied.
-
isUseQuotedIdentifiersGlobally
protected abstract boolean isUseQuotedIdentifiersGlobally()Retrieve whether the user requested that all database identifiers be quoted.- Returns:
- True if the user requested that all database identifiers be quoted, false otherwise.
-
getNamingStrategy
Get the currentNamingStrategy.- Returns:
- The current
NamingStrategy.
-