Interface NamingStrategy
- All Known Implementing Classes:
DefaultNamingStrategy
public interface NamingStrategy
Interface and default implementation of a naming strategy. Defaults to no schema, table name based on
Class
and column name based on RelationalPersistentProperty
with name parts of both separated by '_'.
NOTE: Can also be used as an adapter. Create a lambda or an anonymous subclass and override any settings to implement a different strategy on the fly.
- Author:
- Greg Turnquist, Michael Simons, Kazuki Shimizu, Jens Schauder, Oliver Gierke, Kurt Niemi
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NamingStrategy
Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptiondefault String
getColumnName
(RelationalPersistentProperty property) Defaults to return the givenRelationalPersistentProperty
's name with the parts of a camel case name separated by '_';default String
getKeyColumn
(RelationalPersistentProperty property) For a map valued reference A -> Map>X,B< this is the name of the column in the table for B holding the key of the map.default String
Deprecated, for removal: This API element is subject to removal in a future version.usegetReverseColumnName(RelationalPersistentEntity)
instead.default String
default String
For a reference A -> B this is the name in the table for B which references A.default String
Defaults to no schema.default String
getTableName
(Class<?> type) The name of the table to be used for persisting entities having the type passed as an argument.
-
Field Details
-
INSTANCE
Deprecated, for removal: This API element is subject to removal in a future version.useDefaultNamingStrategy.INSTANCE
instead.Empty implementation of the interface utilizing only the default implementation.Using this avoids creating essentially the same class over and over again.
-
-
Method Details
-
getSchema
Defaults to no schema.- Returns:
- Empty String representing no schema
-
getTableName
The name of the table to be used for persisting entities having the type passed as an argument. The default implementation takes thetype.getSimpleName()
and separates camel case parts with '_'. -
getColumnName
Defaults to return the givenRelationalPersistentProperty
's name with the parts of a camel case name separated by '_'; -
getReverseColumnName
For a reference A -> B this is the name in the table for B which references A.- Parameters:
property
- The property whose column name in the owner table is required- Returns:
- a column name. Must not be
null
.
-
getReverseColumnName
@Deprecated(since="3.2", forRemoval=true) default String getReverseColumnName(PersistentPropertyPathExtension path) Deprecated, for removal: This API element is subject to removal in a future version.usegetReverseColumnName(RelationalPersistentEntity)
instead. -
getReverseColumnName
-
getKeyColumn
For a map valued reference A -> Map>X,B< this is the name of the column in the table for B holding the key of the map.- Returns:
- name of the key column. Must not be
null
.
-
DefaultNamingStrategy.INSTANCE
instead.