Top Description Methods
org.hibernate.engine.jdbc.env.spi

public Interface IdentifierHelper

Known Direct Implementers
org.hibernate.engine.jdbc.env.internal.NormalizingIdentifierHelperImpl
Imports
org.hibernate.boot.model.naming.Identifier, org.hibernate.cfg.AvailableSettings

Helper for handling Identifier instances.
Author
Steve Ebersole

Method Summary

Modifier and TypeMethod and Description
public Identifier

Returns:

The identifier form
applyGlobalQuoting
(String
The text to be (possibly) quoted
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.

public boolean

Returns:

true if the given word represents a reserved word; false otherwise.
isReservedWord
(String
The word to check
word
)

Check whether the given word represents a reserved word.

public Identifier

Returns:

The quoting-normalized Identifier.
normalizeQuoting
(Identifier
The identifier for which to normalize quoting.
identifier
)

Essentially quotes the identifier if it needs to be.

public Identifier

Returns:

The identifier form of the name.
toIdentifier
(String
The text form of a name as obtained from mapping information.
text
)

Generate an Identifier instance from its simple name as obtained from mapping information.

public Identifier

Returns:

The identifier form of the name.
toIdentifier
(String
The text form of a name as obtained from mapping information.
text
,
boolean
Is the identifier to be quoted explicitly.
quoted
)

Generate an Identifier instance from its simple name as obtained from mapping information.

public String

Returns:

The String representation of the given catalog name
toMetaDataCatalogName
(Identifier
The Identifier representation of a catalog name
catalogIdentifier
)

Render the Identifier representation of a catalog name into the String form needed in java.sql.DatabaseMetaData calls.

public String

Returns:

The String representation of the given object name
toMetaDataObjectName
(Identifier
The Identifier representation of an object name
identifier
)

Render the Identifier representation of an object name (table, sequence, etc) into the String form needed in java.sql.DatabaseMetaData calls.

public String

Returns:

The String representation of the given schema name
toMetaDataSchemaName
(Identifier
The Identifier representation of a schema name
schemaIdentifier
)

Render the Identifier representation of a schema name into the String form needed in java.sql.DatabaseMetaData calls.

Method Detail

applyGlobalQuotingback to summary
public Identifier 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.

This method is needed to account for that fact that the JPA spec says that column-definition should be quoted of global-identifier-quoting is requested. Again, this is needed for spec compliance. TBH, I can not think of a argument why column-definitions should ever be *globally* quoted, but the spec is the spec. In fact the default implementation allows applications to opt-out of global-identifier-quoting affecting column-definitions.

Parameters
text:String

The text to be (possibly) quoted

Returns:Identifier

The identifier form

See Also
AvailableSettings#GLOBALLY_QUOTED_IDENTIFIERS_SKIP_COLUMN_DEFINITIONS
isReservedWordback to summary
public boolean isReservedWord(String word)

Check whether the given word represents a reserved word.

Parameters
word:String

The word to check

Returns:boolean

true if the given word represents a reserved word; false otherwise.

normalizeQuotingback to summary
public Identifier normalizeQuoting(Identifier identifier)

Essentially quotes the identifier if it needs to be. Useful to apply global quoting, as well as reserved word quoting after calls to naming strategies.

Parameters
identifier:Identifier

The identifier for which to normalize quoting.

Returns:Identifier

The quoting-normalized Identifier.

toIdentifierback to summary
public Identifier toIdentifier(String text)

Generate an Identifier instance from its simple name as obtained from mapping information.

Note that Identifiers returned from here may be implicitly quoted based on 'globally quoted identifiers' or based on reserved words.

Parameters
text:String

The text form of a name as obtained from mapping information.

Returns:Identifier

The identifier form of the name.

toIdentifierback to summary
public Identifier toIdentifier(String text, boolean quoted)

Generate an Identifier instance from its simple name as obtained from mapping information. Additionally, this form takes a boolean indicating whether to explicitly quote the Identifier.

Note that Identifiers returned from here may be implicitly quoted based on 'globally quoted identifiers' or based on reserved words.

Parameters
text:String

The text form of a name as obtained from mapping information.

quoted:boolean

Is the identifier to be quoted explicitly.

Returns:Identifier

The identifier form of the name.

toMetaDataCatalogNameback to summary
public String toMetaDataCatalogName(Identifier catalogIdentifier)

Render the Identifier representation of a catalog name into the String form needed in java.sql.DatabaseMetaData calls.

Parameters
catalogIdentifier:Identifier

The Identifier representation of a catalog name

Returns:String

The String representation of the given catalog name

toMetaDataObjectNameback to summary
public String toMetaDataObjectName(Identifier identifier)

Render the Identifier representation of an object name (table, sequence, etc) into the String form needed in java.sql.DatabaseMetaData calls.

Parameters
identifier:Identifier

The Identifier representation of an object name

Returns:String

The String representation of the given object name

toMetaDataSchemaNameback to summary
public String toMetaDataSchemaName(Identifier schemaIdentifier)

Render the Identifier representation of a schema name into the String form needed in java.sql.DatabaseMetaData calls.

Parameters
schemaIdentifier:Identifier

The Identifier representation of a schema name

Returns:String

The String representation of the given schema name