Top Description Inners Constructors Methods
org.hibernate.cfg

public abstract Class ObjectNameNormalizer

extends Object
Class Inheritance
Known Direct Subclasses
org.hibernate.cfg.Configuration.ObjectNameNormalizerImpl
Imports
org.hibernate.util.StringHelper

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

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
ObjectNameNormalizer.NamingStrategyHelper

Helper contract for dealing with NamingStrategy in different situations.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected abstract NamingStrategy

Returns:

The current NamingStrategy.
getNamingStrategy
()

Get the current NamingStrategy.

protected abstract boolean

Returns:

True if the user requested that all database identifiers be quoted, false otherwise.
isUseQuotedIdentifiersGlobally
()

Retrieve whether the user requested that all database identifiers be quoted.

public String

Returns:

The normalized identifier.
normalizeDatabaseIdentifier
(final String
The name the user explicitly gave for the database object.
explicitName
,
ObjectNameNormalizer.NamingStrategyHelper
The NamingStrategy helper.
helper
)

Performs the actual contract of normalizing a database name.

public String

Returns:

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

Allow normalizing of just the quoting aspect of identifiers.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ObjectNameNormalizerback to summary
public ObjectNameNormalizer()

Method Detail

getNamingStrategyback to summary
protected abstract NamingStrategy getNamingStrategy()

Get the current NamingStrategy.

Returns:NamingStrategy

The current NamingStrategy.

isUseQuotedIdentifiersGloballyback to summary
protected abstract boolean isUseQuotedIdentifiersGlobally()

Retrieve whether the user requested that all database identifiers be quoted.

Returns:boolean

True if the user requested that all database identifiers be quoted, false otherwise.

normalizeDatabaseIdentifierback to summary
public String normalizeDatabaseIdentifier(final String explicitName, ObjectNameNormalizer.NamingStrategyHelper helper)

Performs the actual contract of normalizing a database name.

Parameters
explicitName:String

The name the user explicitly gave for the database object.

helper:ObjectNameNormalizer.NamingStrategyHelper

The NamingStrategy helper.

Returns:String

The normalized identifier.

normalizeIdentifierQuotingback to summary
public String normalizeIdentifierQuoting(String identifier)

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:String

The identifier to be quoting-normalized.

Returns:String

The identifier accounting for any quoting that need be applied.

org.hibernate.cfg back to summary

public Interface ObjectNameNormalizer.NamingStrategyHelper

Known Direct Implementers
org.hibernate.cfg.annotations.EntityBinder.EntityTableNamingStrategyHelper, org.hibernate.cfg.annotations.EntityBinder.SecondaryTableNamingStrategyHelper

Helper contract for dealing with NamingStrategy in different situations.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

The implicit name
determineImplicitName
(NamingStrategy
The naming strategy in effect
strategy
)

Called when the user supplied no explicit name/identifier for the given database object.

public String

Returns:

The strategy-handled name.
handleExplicitName
(NamingStrategy
The naming strategy in effect
strategy
,
String
The normalized explicit object name.
name
)

Called when the user has supplied an explicit name for the database object.

Method Detail

determineImplicitNameback to summary
public String determineImplicitName(NamingStrategy strategy)

Called when the user supplied no explicit name/identifier for the given database object.

Parameters
strategy:NamingStrategy

The naming strategy in effect

Returns:String

The implicit name

handleExplicitNameback to summary
public String handleExplicitName(NamingStrategy strategy, String name)

Called when the user has supplied an explicit name for the database object.

Parameters
strategy:NamingStrategy

The naming strategy in effect

name:String

The normalized explicit object name.

Returns:String

The strategy-handled name.