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 Details

    • INSTANCE

      @Deprecated(since="2.4", forRemoval=true) static final NamingStrategy INSTANCE
      Deprecated, for removal: This API element is subject to removal in a future version.
      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

      default String getSchema()
      Defaults to no schema.
      Returns:
      Empty String representing no schema
    • getTableName

      default String getTableName(Class<?> type)
      The name of the table to be used for persisting entities having the type passed as an argument. The default implementation takes the type.getSimpleName() and separates camel case parts with '_'.
    • getColumnName

      default String getColumnName(RelationalPersistentProperty property)
      Defaults to return the given RelationalPersistentProperty's name with the parts of a camel case name separated by '_';
    • getReverseColumnName

      default String getReverseColumnName(RelationalPersistentProperty property)
      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.
    • getReverseColumnName

      default String getReverseColumnName(RelationalPersistentEntity<?> owner)
    • getKeyColumn

      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.
      Returns:
      name of the key column. Must not be null.