org.hibernate.cfg

Class DefaultNamingStrategy

Implemented Interfaces:
NamingStrategy, Serializable

public class DefaultNamingStrategy
extends java.lang.Object
implements NamingStrategy, Serializable

The default NamingStrategy
Author:
Gavin King
See Also:
a better alternative

Field Summary

static NamingStrategy
INSTANCE
The singleton instance

Method Summary

String
classToTableName(String className)
Return the unqualified class name
String
collectionTableName(String ownerEntity, String ownerEntityTable, String associatedEntity, String associatedEntityTable, String propertyName)
Return the unqualified property name, not the best strategy but a backward compatible one
String
columnName(String columnName)
Return the argument
String
foreignKeyColumnName(String propertyName, String propertyEntityName, String propertyTableName, String referencedColumnName)
Return the property name or propertyTableName
String
joinKeyColumnName(String joinedColumn, String joinedTable)
Return the argument
String
logicalCollectionColumnName(String columnName, String propertyName, String referencedColumn)
Return the column name if explicit or the concatenation of the property name and the referenced column
String
logicalCollectionTableName(String tableName, String ownerEntityTable, String associatedEntityTable, String propertyName)
Returns either the table name if explicit or if there is an associated table, the concatenation of owner entity table and associated table otherwise the concatenation of owner entity table and the unqualified property name
String
logicalColumnName(String columnName, String propertyName)
Return the column name or the unqualified property name
String
propertyToColumnName(String propertyName)
Return the unqualified property name
String
tableName(String tableName)
Return the argument

Field Details

INSTANCE

public static final NamingStrategy INSTANCE
The singleton instance

Method Details

classToTableName

public String classToTableName(String className)
Return the unqualified class name
Specified by:
classToTableName in interface NamingStrategy

collectionTableName

public String collectionTableName(String ownerEntity,
                                  String ownerEntityTable,
                                  String associatedEntity,
                                  String associatedEntityTable,
                                  String propertyName)
Return the unqualified property name, not the best strategy but a backward compatible one
Specified by:
collectionTableName in interface NamingStrategy

columnName

public String columnName(String columnName)
Return the argument
Specified by:
columnName in interface NamingStrategy

foreignKeyColumnName

public String foreignKeyColumnName(String propertyName,
                                   String propertyEntityName,
                                   String propertyTableName,
                                   String referencedColumnName)
Return the property name or propertyTableName
Specified by:
foreignKeyColumnName in interface NamingStrategy

joinKeyColumnName

public String joinKeyColumnName(String joinedColumn,
                                String joinedTable)
Return the argument
Specified by:
joinKeyColumnName in interface NamingStrategy

logicalCollectionColumnName

public String logicalCollectionColumnName(String columnName,
                                          String propertyName,
                                          String referencedColumn)
Return the column name if explicit or the concatenation of the property name and the referenced column
Specified by:
logicalCollectionColumnName in interface NamingStrategy

logicalCollectionTableName

public String logicalCollectionTableName(String tableName,
                                         String ownerEntityTable,
                                         String associatedEntityTable,
                                         String propertyName)
Returns either the table name if explicit or if there is an associated table, the concatenation of owner entity table and associated table otherwise the concatenation of owner entity table and the unqualified property name
Specified by:
logicalCollectionTableName in interface NamingStrategy

logicalColumnName

public String logicalColumnName(String columnName,
                                String propertyName)
Return the column name or the unqualified property name
Specified by:
logicalColumnName in interface NamingStrategy

propertyToColumnName

public String propertyToColumnName(String propertyName)
Return the unqualified property name
Specified by:
propertyToColumnName in interface NamingStrategy

tableName

public String tableName(String tableName)
Return the argument
Specified by:
tableName in interface NamingStrategy