Class NomulusNamingStrategy

java.lang.Object
google.registry.persistence.NomulusNamingStrategy
All Implemented Interfaces:
org.hibernate.boot.model.naming.PhysicalNamingStrategy

public class NomulusNamingStrategy extends Object implements org.hibernate.boot.model.naming.PhysicalNamingStrategy
Nomulus naming strategy for Hibernate ORM.

This class applies the following naming strategies to protect readability of SQL statements:

  • Table names are quoted UpperCamelCases.
  • Column names are in lower_underscore format.
These strategies ensure that both types of names are readable on case-insensitive platforms, and are easily distinguishable from each other.

The use of quoted names may introduce portability problems with hand-crafted SQL queries, e.g., between postgresql (which only accepts double-quotes) and MySQL(which only accepts back-quotes). This gives us incentives for adopting SQL query builders such as JOOQ for reporting etc.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.hibernate.boot.model.naming.Identifier
    toPhysicalCatalogName(org.hibernate.boot.model.naming.Identifier name, org.hibernate.engine.jdbc.env.spi.JdbcEnvironment jdbcEnvironment)
     
    org.hibernate.boot.model.naming.Identifier
    toPhysicalColumnName(org.hibernate.boot.model.naming.Identifier name, org.hibernate.engine.jdbc.env.spi.JdbcEnvironment jdbcEnvironment)
     
    org.hibernate.boot.model.naming.Identifier
    toPhysicalSchemaName(org.hibernate.boot.model.naming.Identifier name, org.hibernate.engine.jdbc.env.spi.JdbcEnvironment jdbcEnvironment)
     
    org.hibernate.boot.model.naming.Identifier
    toPhysicalSequenceName(org.hibernate.boot.model.naming.Identifier name, org.hibernate.engine.jdbc.env.spi.JdbcEnvironment jdbcEnvironment)
     
    org.hibernate.boot.model.naming.Identifier
    toPhysicalTableName(org.hibernate.boot.model.naming.Identifier name, org.hibernate.engine.jdbc.env.spi.JdbcEnvironment jdbcEnvironment)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.hibernate.boot.model.naming.PhysicalNamingStrategy

    toPhysicalTypeName
  • Constructor Details

    • NomulusNamingStrategy

      public NomulusNamingStrategy()
  • Method Details

    • toPhysicalCatalogName

      public org.hibernate.boot.model.naming.Identifier toPhysicalCatalogName(org.hibernate.boot.model.naming.Identifier name, org.hibernate.engine.jdbc.env.spi.JdbcEnvironment jdbcEnvironment)
      Specified by:
      toPhysicalCatalogName in interface org.hibernate.boot.model.naming.PhysicalNamingStrategy
    • toPhysicalSchemaName

      public org.hibernate.boot.model.naming.Identifier toPhysicalSchemaName(org.hibernate.boot.model.naming.Identifier name, org.hibernate.engine.jdbc.env.spi.JdbcEnvironment jdbcEnvironment)
      Specified by:
      toPhysicalSchemaName in interface org.hibernate.boot.model.naming.PhysicalNamingStrategy
    • toPhysicalTableName

      public org.hibernate.boot.model.naming.Identifier toPhysicalTableName(org.hibernate.boot.model.naming.Identifier name, org.hibernate.engine.jdbc.env.spi.JdbcEnvironment jdbcEnvironment)
      Specified by:
      toPhysicalTableName in interface org.hibernate.boot.model.naming.PhysicalNamingStrategy
    • toPhysicalSequenceName

      public org.hibernate.boot.model.naming.Identifier toPhysicalSequenceName(org.hibernate.boot.model.naming.Identifier name, org.hibernate.engine.jdbc.env.spi.JdbcEnvironment jdbcEnvironment)
      Specified by:
      toPhysicalSequenceName in interface org.hibernate.boot.model.naming.PhysicalNamingStrategy
    • toPhysicalColumnName

      public org.hibernate.boot.model.naming.Identifier toPhysicalColumnName(org.hibernate.boot.model.naming.Identifier name, org.hibernate.engine.jdbc.env.spi.JdbcEnvironment jdbcEnvironment)
      Specified by:
      toPhysicalColumnName in interface org.hibernate.boot.model.naming.PhysicalNamingStrategy