jodd.db.orm.sqlgen.fk
Class DefaultFkNamingConvention

java.lang.Object
  extended by jodd.db.orm.sqlgen.fk.DefaultFkNamingConvention
All Implemented Interfaces:
FkNamingConvention

public class DefaultFkNamingConvention
extends java.lang.Object
implements FkNamingConvention

Default FK naming convention uses foreign table column name and, optionally, table name.


Field Summary
protected  java.lang.String optPrefix
           
protected  boolean useTableName
           
 
Constructor Summary
DefaultFkNamingConvention()
           
DefaultFkNamingConvention(boolean useTableName)
           
DefaultFkNamingConvention(java.lang.String optPrefixToRemove)
           
 
Method Summary
 java.lang.String resolveFkName(DbEntityDescriptor foreignTable, DbEntityDescriptor thisTable)
          Resolve foreign key name from foreign table and this table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

useTableName

protected final boolean useTableName

optPrefix

protected java.lang.String optPrefix
Constructor Detail

DefaultFkNamingConvention

public DefaultFkNamingConvention()

DefaultFkNamingConvention

public DefaultFkNamingConvention(boolean useTableName)

DefaultFkNamingConvention

public DefaultFkNamingConvention(java.lang.String optPrefixToRemove)
Method Detail

resolveFkName

public java.lang.String resolveFkName(DbEntityDescriptor foreignTable,
                                      DbEntityDescriptor thisTable)
Resolve foreign key name from foreign table and this table.

Example: Lets have table GIRL that has an ID column. Lets have table BOY that has a foreign key to a GIRL. In this example, method will receive following arguments:

  • foreignTable = (GIRL)
  • thisTable = (BOY) The resulting foreign key might be: "GIRL_ID".

    Specified by:
    resolveFkName in interface FkNamingConvention


  • Copyright ©2008 Jodd Team