Package org.hibernate.boot.model.naming
Class ImplicitNamingStrategyJpaCompliantImpl
java.lang.Object
org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl
- All Implemented Interfaces:
Serializable
,ImplicitNamingStrategy
- Direct Known Subclasses:
ImplicitNamingStrategyComponentPathImpl
,ImplicitNamingStrategyLegacyHbmImpl
,ImplicitNamingStrategyLegacyJpaImpl
public class ImplicitNamingStrategyJpaCompliantImpl
extends Object
implements ImplicitNamingStrategy, Serializable
Implementation of the
ImplicitNamingStrategy
contract, generally
preferring to conform to JPA standards.
For the legacy JPA-based naming standards initially implemented by Hibernate,
see/use ImplicitNamingStrategyLegacyJpaImpl
.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDetermine the column name related to the discriminator portion of anAny
mapping when no explicit column name is given usingColumn.name()
.Determine the join column name related to the key/id portion of anAny
mapping when no explicit join column name is given usingJoinColumn.name()
.JPA states we should use the following as default: The property or field name That is, the unqualified attribute path.JPA states we should use the following as default: The concatenation of the name of the containing entity and the name of the collection attribute, separated by an underscore. That is, if owning entity has a JPA entity name:Determine the discriminator column name for the given entity when it is not explicitly specified usingDiscriminatorColumn.name()
.Determine the foreign key name when it is not explicitly specified usingForeignKey.name()
.Determine the name if the identifier column belonging to the given entity when it is not explicitly specified usingColumn.name()
.Determine the index name when it is not explicitly specified usingIndex.name()
.JPA states we should use the following as default: If there is a "referencing relationship property": The concatenation of the following: the name of the referencing relationship property or field of the referencing entity or embeddable class;_
; the name of the referenced primary key column. If there is no such "referencing relationship property", or if the association is an element collection: The concatenation of the following: the name of the entity;_
; the name of the referenced primary key columnJPA states we should use the following as default: The concatenated names of the two associated primary entity tables (owning side first), separated by an underscore. That is:Determine the list index column name when it is not explicitly specified usingOrderColumn.name()
.Determine the map key column name when it is not explicitly specified usingMapKeyColumn.name()
.JPA states we should use the following as default: the same name as the primary key column [of the referenced table]Determine the implicit name of an entity's primary table.Determine the implicit name of the tenant identifier column belonging to a given entity when it is not explicitly specified usingColumn.name()
.Determine the unique key name when it is not explicitly specified usingUniqueConstraint.name()
.protected Identifier
toIdentifier
(String stringForm, MetadataBuildingContext buildingContext) Easy hook to build an Identifier using the keyword safe IdentifierHelper.protected String
transformAttributePath
(AttributePath attributePath) For JPA standards we typically need the unqualified name.protected String
transformEntityName
(EntityNaming entityNaming)
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
ImplicitNamingStrategyJpaCompliantImpl
public ImplicitNamingStrategyJpaCompliantImpl()
-
-
Method Details
-
determinePrimaryTableName
Description copied from interface:ImplicitNamingStrategy
Determine the implicit name of an entity's primary table.- Specified by:
determinePrimaryTableName
in interfaceImplicitNamingStrategy
- Parameters:
source
- The source information- Returns:
- The implicit table name.
-
transformEntityName
-
determineJoinTableName
JPA states we should use the following as default:The concatenated names of the two associated primary entity tables (owning side first), separated by an underscore.
That is:{OWNING SIDE PRIMARY TABLE NAME}_{NON-OWNING SIDE PRIMARY TABLE NAME}
- Specified by:
determineJoinTableName
in interfaceImplicitNamingStrategy
- Parameters:
source
- The source information- Returns:
- The implicit table name.
-
determineCollectionTableName
JPA states we should use the following as default:The concatenation of the name of the containing entity and the name of the collection attribute, separated by an underscore.
That is, if owning entity has a JPA entity name:{OWNER JPA ENTITY NAME}_{COLLECTION ATTRIBUTE NAME}
otherwise:{OWNER ENTITY NAME}_{COLLECTION ATTRIBUTE NAME}
- Specified by:
determineCollectionTableName
in interfaceImplicitNamingStrategy
- Parameters:
source
- The source information- Returns:
- The implicit table name.
-
determineIdentifierColumnName
Description copied from interface:ImplicitNamingStrategy
Determine the name if the identifier column belonging to the given entity when it is not explicitly specified usingColumn.name()
.- Specified by:
determineIdentifierColumnName
in interfaceImplicitNamingStrategy
- Parameters:
source
- The source information- Returns:
- The determined identifier column name
-
determineDiscriminatorColumnName
Description copied from interface:ImplicitNamingStrategy
Determine the discriminator column name for the given entity when it is not explicitly specified usingDiscriminatorColumn.name()
.- Specified by:
determineDiscriminatorColumnName
in interfaceImplicitNamingStrategy
- Parameters:
source
- The source information- Returns:
- The implicit discriminator column name
-
determineTenantIdColumnName
Description copied from interface:ImplicitNamingStrategy
Determine the implicit name of the tenant identifier column belonging to a given entity when it is not explicitly specified usingColumn.name()
.- Specified by:
determineTenantIdColumnName
in interfaceImplicitNamingStrategy
- Parameters:
source
- The source information- Returns:
- The determined tenant identifier column name
-
determineBasicColumnName
JPA states we should use the following as default:The property or field name
That is, the unqualified attribute path.- Specified by:
determineBasicColumnName
in interfaceImplicitNamingStrategy
- Parameters:
source
- The source information- Returns:
- The implicit column name.
-
determineJoinColumnName
JPA states we should use the following as default:- If there is a "referencing relationship property":
The concatenation of the following: the name of the referencing relationship property or field of the referencing entity or embeddable class;
_
; the name of the referenced primary key column. - If there is no such "referencing relationship property",
or if the association is an element collection:
The concatenation of the following: the name of the entity;
_
; the name of the referenced primary key column
- Specified by:
determineJoinColumnName
in interfaceImplicitNamingStrategy
- Parameters:
source
- The source information- Returns:
- The determined join column name
- If there is a "referencing relationship property":
-
determinePrimaryKeyJoinColumnName
JPA states we should use the following as default:the same name as the primary key column [of the referenced table]
- Specified by:
determinePrimaryKeyJoinColumnName
in interfaceImplicitNamingStrategy
- Parameters:
source
- The source information- Returns:
- The determined column name
-
determineAnyDiscriminatorColumnName
public Identifier determineAnyDiscriminatorColumnName(ImplicitAnyDiscriminatorColumnNameSource source) Description copied from interface:ImplicitNamingStrategy
Determine the column name related to the discriminator portion of anAny
mapping when no explicit column name is given usingColumn.name()
.- Specified by:
determineAnyDiscriminatorColumnName
in interfaceImplicitNamingStrategy
- Parameters:
source
- The source information- Returns:
- The determined column name
-
determineAnyKeyColumnName
Description copied from interface:ImplicitNamingStrategy
Determine the join column name related to the key/id portion of anAny
mapping when no explicit join column name is given usingJoinColumn.name()
.- Specified by:
determineAnyKeyColumnName
in interfaceImplicitNamingStrategy
- Parameters:
source
- The source information- Returns:
- The determined identifier column name
-
determineMapKeyColumnName
Description copied from interface:ImplicitNamingStrategy
Determine the map key column name when it is not explicitly specified usingMapKeyColumn.name()
.- Specified by:
determineMapKeyColumnName
in interfaceImplicitNamingStrategy
- Parameters:
source
- The source information- Returns:
- The implicit column name.
-
determineListIndexColumnName
Description copied from interface:ImplicitNamingStrategy
Determine the list index column name when it is not explicitly specified usingOrderColumn.name()
.- Specified by:
determineListIndexColumnName
in interfaceImplicitNamingStrategy
- Parameters:
source
- The source information- Returns:
- The implicit column name.
-
determineForeignKeyName
Description copied from interface:ImplicitNamingStrategy
Determine the foreign key name when it is not explicitly specified usingForeignKey.name()
.- Specified by:
determineForeignKeyName
in interfaceImplicitNamingStrategy
- Parameters:
source
- The source information- Returns:
- The determined foreign key name
-
determineUniqueKeyName
Description copied from interface:ImplicitNamingStrategy
Determine the unique key name when it is not explicitly specified usingUniqueConstraint.name()
.- Specified by:
determineUniqueKeyName
in interfaceImplicitNamingStrategy
- Parameters:
source
- The source information- Returns:
- The determined foreign key name
-
determineIndexName
Description copied from interface:ImplicitNamingStrategy
Determine the index name when it is not explicitly specified usingIndex.name()
.- Specified by:
determineIndexName
in interfaceImplicitNamingStrategy
- Parameters:
source
- The source information- Returns:
- The determined foreign key name
-
transformAttributePath
For JPA standards we typically need the unqualified name. However, a more usable impl tends to use the whole path. This method provides an easy hook for subclasses to accomplish that- Parameters:
attributePath
- The attribute path- Returns:
- The extracted name
-
toIdentifier
Easy hook to build an Identifier using the keyword safe IdentifierHelper.- Parameters:
stringForm
- The String form of the namebuildingContext
- Access to the IdentifierHelper- Returns:
- The identifier
-