Interface ImplicitNamingStrategy
-
- All Known Implementing Classes:
ImplicitNamingStrategyComponentPathImpl
,ImplicitNamingStrategyJpaCompliantImpl
,ImplicitNamingStrategyLegacyHbmImpl
,ImplicitNamingStrategyLegacyJpaImpl
@Incubating public interface ImplicitNamingStrategy
A set of rules for determining the logical name of a mapped relational database object when the mapping for an element of the Java domain model is not explicitly specified, neither in annotations of the Java code, nor in an XML-based mapping document.For example, if a Java class annotated
@Entity
has no@Table
annotation, thendeterminePrimaryTableName
is called with anImplicitEntityNameSource
providing access to information about the Java class and itsentity name
.On the other hand, when a logical name is explicitly specified, for example, using
@Table
to specify the table name, or@Column
to specify a column name, theImplicitNamingStrategy
is not called and has no opportunity to intervene in the determination of the logical name.However, a further level of processing is applied to the resulting logical names by a
PhysicalNamingStrategy
in order to determine the "finally final" physical names in the relational database schema.Whenever reasonable, the use of a custom
ImplicitNamingStrategy
is highly recommended in preference to tedious and repetitive explicit table and column name mappings. It's anticipated that most projects using Hibernate will feature a custom implementation ofImplicitNamingStrategy
.An
ImplicitNamingStrategy
may be selected using the configuration property "hibernate.implicit_naming_strategy".- See Also:
PhysicalNamingStrategy
,Configuration.setImplicitNamingStrategy(ImplicitNamingStrategy)
,MetadataBuilder.applyImplicitNamingStrategy(ImplicitNamingStrategy)
,AvailableSettings.IMPLICIT_NAMING_STRATEGY
- API Note:
- The method names here mostly favor the JPA terminology, for example, "secondary table" rather than "join".
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Identifier
determineAnyDiscriminatorColumnName(ImplicitAnyDiscriminatorColumnNameSource source)
Determine the column name related to the discriminator portion of anAny
mapping when no explicit column name is given usingColumn.name()
.Identifier
determineAnyKeyColumnName(ImplicitAnyKeyColumnNameSource source)
Determine the join column name related to the key/id portion of anAny
mapping when no explicit join column name is given usingJoinColumn.name()
.Identifier
determineBasicColumnName(ImplicitBasicColumnNameSource source)
Determine the column name when it is not explicitly specified usingColumn.name()
.Identifier
determineCollectionTableName(ImplicitCollectionTableNameSource source)
Determine the name of a collection join table given the source naming information, when a name is not explicitly given.Identifier
determineDiscriminatorColumnName(ImplicitDiscriminatorColumnNameSource source)
Determine the discriminator column name for the given entity when it is not explicitly specified usingDiscriminatorColumn.name()
.Identifier
determineForeignKeyName(ImplicitForeignKeyNameSource source)
Determine the foreign key name when it is not explicitly specified usingForeignKey.name()
.Identifier
determineIdentifierColumnName(ImplicitIdentifierColumnNameSource source)
Determine the name if the identifier column belonging to the given entity when it is not explicitly specified usingColumn.name()
.Identifier
determineIndexName(ImplicitIndexNameSource source)
Determine the index name when it is not explicitly specified usingIndex.name()
.Identifier
determineJoinColumnName(ImplicitJoinColumnNameSource source)
Determine the join column name when it is not explicitly specified usingJoinColumn.name()
.Identifier
determineJoinTableName(ImplicitJoinTableNameSource source)
Determine the name of an association join table given the source naming information, when a name is not explicitly given.Identifier
determineListIndexColumnName(ImplicitIndexColumnNameSource source)
Determine the list index column name when it is not explicitly specified usingOrderColumn.name()
.Identifier
determineMapKeyColumnName(ImplicitMapKeyColumnNameSource source)
Determine the map key column name when it is not explicitly specified usingMapKeyColumn.name()
.Identifier
determinePrimaryKeyJoinColumnName(ImplicitPrimaryKeyJoinColumnNameSource source)
Determine the primary key join column name when it is not explicitly specified usingPrimaryKeyJoinColumn.name()
.Identifier
determinePrimaryTableName(ImplicitEntityNameSource source)
Determine the implicit name of an entity's primary table.Identifier
determineTenantIdColumnName(ImplicitTenantIdColumnNameSource source)
Determine the implicit name of the tenant identifier column belonging to a given entity when it is not explicitly specified usingColumn.name()
.Identifier
determineUniqueKeyName(ImplicitUniqueKeyNameSource source)
Determine the unique key name when it is not explicitly specified usingUniqueConstraint.name()
.
-
-
-
Method Detail
-
determinePrimaryTableName
Identifier determinePrimaryTableName(ImplicitEntityNameSource source)
Determine the implicit name of an entity's primary table.- Parameters:
source
- The source information- Returns:
- The implicit table name.
-
determineJoinTableName
Identifier determineJoinTableName(ImplicitJoinTableNameSource source)
Determine the name of an association join table given the source naming information, when a name is not explicitly given. This method is called for any sort of association with a join table, no matter what the logical cardinality.- Parameters:
source
- The source information- Returns:
- The implicit table name.
-
determineCollectionTableName
Identifier determineCollectionTableName(ImplicitCollectionTableNameSource source)
Determine the name of a collection join table given the source naming information, when a name is not explicitly given. This method is called only for collections of basic or embeddable values, and never for associations.- Parameters:
source
- The source information- Returns:
- The implicit table name.
-
determineDiscriminatorColumnName
Identifier determineDiscriminatorColumnName(ImplicitDiscriminatorColumnNameSource source)
Determine the discriminator column name for the given entity when it is not explicitly specified usingDiscriminatorColumn.name()
.- Parameters:
source
- The source information- Returns:
- The implicit discriminator column name
-
determineTenantIdColumnName
Identifier determineTenantIdColumnName(ImplicitTenantIdColumnNameSource source)
Determine the implicit name of the tenant identifier column belonging to a given entity when it is not explicitly specified usingColumn.name()
.- Parameters:
source
- The source information- Returns:
- The determined tenant identifier column name
-
determineIdentifierColumnName
Identifier determineIdentifierColumnName(ImplicitIdentifierColumnNameSource source)
Determine the name if the identifier column belonging to the given entity when it is not explicitly specified usingColumn.name()
.- Parameters:
source
- The source information- Returns:
- The determined identifier column name
-
determineBasicColumnName
Identifier determineBasicColumnName(ImplicitBasicColumnNameSource source)
Determine the column name when it is not explicitly specified usingColumn.name()
.- Parameters:
source
- The source information- Returns:
- The implicit column name.
-
determineJoinColumnName
Identifier determineJoinColumnName(ImplicitJoinColumnNameSource source)
Determine the join column name when it is not explicitly specified usingJoinColumn.name()
.In
hbm.xml
terms, this would be a<key/>
defined for a collection or the column associated with a many-to-one.- Parameters:
source
- The source information- Returns:
- The determined join column name
-
determinePrimaryKeyJoinColumnName
Identifier determinePrimaryKeyJoinColumnName(ImplicitPrimaryKeyJoinColumnNameSource source)
Determine the primary key join column name when it is not explicitly specified usingPrimaryKeyJoinColumn.name()
.In
hbm.xml
terms, this would be a<key/>
defined for a<join/>
or a<joined-subclass/>
.- Parameters:
source
- The source information- Returns:
- The determined column name
-
determineAnyDiscriminatorColumnName
Identifier determineAnyDiscriminatorColumnName(ImplicitAnyDiscriminatorColumnNameSource source)
Determine the column name related to the discriminator portion of anAny
mapping when no explicit column name is given usingColumn.name()
.- Parameters:
source
- The source information- Returns:
- The determined column name
-
determineAnyKeyColumnName
Identifier determineAnyKeyColumnName(ImplicitAnyKeyColumnNameSource source)
Determine the join column name related to the key/id portion of anAny
mapping when no explicit join column name is given usingJoinColumn.name()
.- Parameters:
source
- The source information- Returns:
- The determined identifier column name
-
determineMapKeyColumnName
Identifier determineMapKeyColumnName(ImplicitMapKeyColumnNameSource source)
Determine the map key column name when it is not explicitly specified usingMapKeyColumn.name()
.- Parameters:
source
- The source information- Returns:
- The implicit column name.
-
determineListIndexColumnName
Identifier determineListIndexColumnName(ImplicitIndexColumnNameSource source)
Determine the list index column name when it is not explicitly specified usingOrderColumn.name()
.- Parameters:
source
- The source information- Returns:
- The implicit column name.
-
determineForeignKeyName
Identifier determineForeignKeyName(ImplicitForeignKeyNameSource source)
Determine the foreign key name when it is not explicitly specified usingForeignKey.name()
.- Parameters:
source
- The source information- Returns:
- The determined foreign key name
-
determineUniqueKeyName
Identifier determineUniqueKeyName(ImplicitUniqueKeyNameSource source)
Determine the unique key name when it is not explicitly specified usingUniqueConstraint.name()
.- Parameters:
source
- The source information- Returns:
- The determined foreign key name
-
determineIndexName
Identifier determineIndexName(ImplicitIndexNameSource source)
Determine the index name when it is not explicitly specified usingIndex.name()
.- Parameters:
source
- The source information- Returns:
- The determined foreign key name
-
-