Interface NamingStrategy


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
  • Field Details

    • INSTANCE

      static final NamingStrategy INSTANCE
      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 '_';
    • getQualifiedTableName

      @Deprecated default String getQualifiedTableName(Class<?> type)
      Deprecated.
      since 2.0. The method returns a concatenated schema with table name which conflicts with escaping. Use rather getTableName(Class) and getSchema() independently
      Parameters:
      type -
      Returns:
    • 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 who's column name in the owner table is required
      Returns:
      a column name. Must not be null.
    • getReverseColumnName

      default String getReverseColumnName(PersistentPropertyPathExtension path)
    • 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.