com.vladmihalcea.hibernate.type.util
Class CamelCaseToSnakeCaseNamingStrategy

java.lang.Object
  extended by org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
      extended by com.vladmihalcea.hibernate.type.util.CamelCaseToSnakeCaseNamingStrategy
All Implemented Interfaces:
Serializable, org.hibernate.boot.model.naming.PhysicalNamingStrategy

public class CamelCaseToSnakeCaseNamingStrategy
extends org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl

Maps the JPA camelCase properties to snake_case database identifiers.

For more details about how to use it, check out this article on vladmihalcea.com.

Author:
Vlad Mihalcea
See Also:
Serialized Form

Field Summary
static String CAMEL_CASE_REGEX
           
static CamelCaseToSnakeCaseNamingStrategy INSTANCE
           
static String SNAKE_CASE_PATTERN
           
 
Constructor Summary
CamelCaseToSnakeCaseNamingStrategy()
          Initialization constructor taking the default Configuration object.
CamelCaseToSnakeCaseNamingStrategy(Configuration configuration)
          Initialization constructor taking the Class and Configuration objects.
 
Method Summary
 org.hibernate.boot.model.naming.Identifier toPhysicalCatalogName(org.hibernate.boot.model.naming.Identifier name, org.hibernate.engine.jdbc.env.spi.JdbcEnvironment context)
           
 org.hibernate.boot.model.naming.Identifier toPhysicalColumnName(org.hibernate.boot.model.naming.Identifier name, org.hibernate.engine.jdbc.env.spi.JdbcEnvironment context)
           
 org.hibernate.boot.model.naming.Identifier toPhysicalSchemaName(org.hibernate.boot.model.naming.Identifier name, org.hibernate.engine.jdbc.env.spi.JdbcEnvironment context)
           
 org.hibernate.boot.model.naming.Identifier toPhysicalSequenceName(org.hibernate.boot.model.naming.Identifier name, org.hibernate.engine.jdbc.env.spi.JdbcEnvironment context)
           
 org.hibernate.boot.model.naming.Identifier toPhysicalTableName(org.hibernate.boot.model.naming.Identifier name, org.hibernate.engine.jdbc.env.spi.JdbcEnvironment context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final CamelCaseToSnakeCaseNamingStrategy INSTANCE

CAMEL_CASE_REGEX

public static final String CAMEL_CASE_REGEX
See Also:
Constant Field Values

SNAKE_CASE_PATTERN

public static final String SNAKE_CASE_PATTERN
See Also:
Constant Field Values
Constructor Detail

CamelCaseToSnakeCaseNamingStrategy

public CamelCaseToSnakeCaseNamingStrategy()
Initialization constructor taking the default Configuration object.


CamelCaseToSnakeCaseNamingStrategy

public CamelCaseToSnakeCaseNamingStrategy(Configuration configuration)
Initialization constructor taking the Class and Configuration objects.

Parameters:
configuration - custom Configuration object.
Method Detail

toPhysicalCatalogName

public org.hibernate.boot.model.naming.Identifier toPhysicalCatalogName(org.hibernate.boot.model.naming.Identifier name,
                                                                        org.hibernate.engine.jdbc.env.spi.JdbcEnvironment context)
Specified by:
toPhysicalCatalogName in interface org.hibernate.boot.model.naming.PhysicalNamingStrategy
Overrides:
toPhysicalCatalogName in class org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl

toPhysicalSchemaName

public org.hibernate.boot.model.naming.Identifier toPhysicalSchemaName(org.hibernate.boot.model.naming.Identifier name,
                                                                       org.hibernate.engine.jdbc.env.spi.JdbcEnvironment context)
Specified by:
toPhysicalSchemaName in interface org.hibernate.boot.model.naming.PhysicalNamingStrategy
Overrides:
toPhysicalSchemaName in class org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl

toPhysicalTableName

public org.hibernate.boot.model.naming.Identifier toPhysicalTableName(org.hibernate.boot.model.naming.Identifier name,
                                                                      org.hibernate.engine.jdbc.env.spi.JdbcEnvironment context)
Specified by:
toPhysicalTableName in interface org.hibernate.boot.model.naming.PhysicalNamingStrategy
Overrides:
toPhysicalTableName in class org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl

toPhysicalSequenceName

public org.hibernate.boot.model.naming.Identifier toPhysicalSequenceName(org.hibernate.boot.model.naming.Identifier name,
                                                                         org.hibernate.engine.jdbc.env.spi.JdbcEnvironment context)
Specified by:
toPhysicalSequenceName in interface org.hibernate.boot.model.naming.PhysicalNamingStrategy
Overrides:
toPhysicalSequenceName in class org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl

toPhysicalColumnName

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


Copyright © 2020. All rights reserved.