|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hibernate.cfg.ImprovedNamingStrategy
public class ImprovedNamingStrategy
An improved naming strategy that prefers embedded underscores to mixed case names
the default strategy
,
Serialized FormField Summary | |
---|---|
static NamingStrategy |
INSTANCE
A convenient singleton instance |
Constructor Summary | |
---|---|
ImprovedNamingStrategy()
|
Method Summary | |
---|---|
protected static String |
addUnderscores(String name)
|
String |
classToTableName(String className)
Return the unqualified class name, mixed case converted to underscores |
String |
collectionTableName(String ownerEntity,
String ownerEntityTable,
String associatedEntity,
String associatedEntityTable,
String propertyName)
Return a collection table name ie an association having a join table |
String |
columnName(String columnName)
Convert mixed case to underscores |
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 full property path with underscore seperators, mixed case converted to underscores |
String |
tableName(String tableName)
Convert mixed case to underscores |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final NamingStrategy INSTANCE
Constructor Detail |
---|
public ImprovedNamingStrategy()
Method Detail |
---|
public String classToTableName(String className)
classToTableName
in interface NamingStrategy
className
- the fully-qualified class name
public String propertyToColumnName(String propertyName)
propertyToColumnName
in interface NamingStrategy
propertyName
- a property path
public String tableName(String tableName)
tableName
in interface NamingStrategy
tableName
- a table name
public String columnName(String columnName)
columnName
in interface NamingStrategy
columnName
- a column name
protected static String addUnderscores(String name)
public String collectionTableName(String ownerEntity, String ownerEntityTable, String associatedEntity, String associatedEntityTable, String propertyName)
NamingStrategy
collectionTableName
in interface NamingStrategy
ownerEntityTable
- owner side table nameassociatedEntityTable
- reverse side table name if anypropertyName
- collection rolepublic String joinKeyColumnName(String joinedColumn, String joinedTable)
joinKeyColumnName
in interface NamingStrategy
joinedColumn
- joined column name (logical one) used to join withjoinedTable
- joined table name (ie the referenced table) used to join withpublic String foreignKeyColumnName(String propertyName, String propertyEntityName, String propertyTableName, String referencedColumnName)
foreignKeyColumnName
in interface NamingStrategy
propertyName
- the property name involvedpropertyTableName
- the property table name involved (logical one)referencedColumnName
- the referenced column name involved (logical one)public String logicalColumnName(String columnName, String propertyName)
logicalColumnName
in interface NamingStrategy
columnName
- given column name if anypropertyName
- property name of this columnpublic String logicalCollectionTableName(String tableName, String ownerEntityTable, String associatedEntityTable, String propertyName)
logicalCollectionTableName
in interface NamingStrategy
tableName
- the metadata explicit nameownerEntityTable
- owner table entity table name (logical one)associatedEntityTable
- reverse side table name if any (logical one)propertyName
- collection rolepublic String logicalCollectionColumnName(String columnName, String propertyName, String referencedColumn)
logicalCollectionColumnName
in interface NamingStrategy
columnName
- given column name in the metadata if anypropertyName
- property namereferencedColumn
- referenced column name (logical one) in the join
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |