Ontimize 5.2072EN

com.ontimize.db.sql
Class SQLForeignKey

java.lang.Object
  extended bycom.ontimize.db.sql.SQLConstraint
      extended bycom.ontimize.db.sql.SQLForeignKey
All Implemented Interfaces:
java.io.Serializable

public class SQLForeignKey
extends SQLConstraint

See Also:
Serialized Form

Field Summary
protected static java.lang.String FOREIGN_KEY
           
protected  java.util.List foreignColumns
          The list of columns of the referenced table in where the constraint is applied.
protected static java.lang.String REFERENCES
           
protected  java.lang.String secondaryTable
          The name of the referenced table
 
Fields inherited from class com.ontimize.db.sql.SQLConstraint
columns, CONSTRAINT, constraintName
 
Constructor Summary
SQLForeignKey(java.lang.String constraintName)
           
SQLForeignKey(java.lang.String secondaryTable, java.util.Hashtable keys)
           
SQLForeignKey(java.lang.String constraintName, java.lang.String secondaryTable, java.util.Hashtable keys)
           
 
Method Summary
 java.util.List getForeignColumns()
          This method returns the list of column/s of the referenced table that are going to be used into the constraint.
 java.lang.String getSecondaryTable()
          Returns the name of the referenced table.
 void setKeys(java.util.Hashtable keys)
           
 void setSecondaryTable(java.lang.String secondaryTable)
          This method sets the name of the referenced table of the Foreign key.
 java.lang.String toString()
          This method returns the SQL Statement to add a Foreign Key constraint to a database table.
 
Methods inherited from class com.ontimize.db.sql.SQLConstraint
getColumnList, getColumns, getConstraintName, setConstraintName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FOREIGN_KEY

protected static final java.lang.String FOREIGN_KEY
See Also:
Constant Field Values

REFERENCES

protected static final java.lang.String REFERENCES
See Also:
Constant Field Values

secondaryTable

protected java.lang.String secondaryTable
The name of the referenced table


foreignColumns

protected java.util.List foreignColumns
The list of columns of the referenced table in where the constraint is applied.

Constructor Detail

SQLForeignKey

public SQLForeignKey(java.lang.String secondaryTable,
                     java.util.Hashtable keys)
Parameters:
secondaryTable - The table, in which the restriction is made,
keys - Must contains a pair key-value, where key is the table column and value is the name of reference column.

SQLForeignKey

public SQLForeignKey(java.lang.String constraintName,
                     java.lang.String secondaryTable,
                     java.util.Hashtable keys)
Parameters:
constraintName - The name of the constraint.
secondaryTable - The table, in which the restriction is made,
keys - Must contains a pair key-value, where key is the table column and value is the name of reference column.

SQLForeignKey

public SQLForeignKey(java.lang.String constraintName)
Parameters:
constraintName - The name of the constraint.
Method Detail

getForeignColumns

public java.util.List getForeignColumns()
This method returns the list of column/s of the referenced table that are going to be used into the constraint.

Returns:
a String with the column/s between parenthesis

setKeys

public void setKeys(java.util.Hashtable keys)
Parameters:
keys - Must contains a pair key-value, where key is the table column and value is the name of reference column.

getSecondaryTable

public java.lang.String getSecondaryTable()
Returns the name of the referenced table. The table, in which the restriction is made.

Returns:
a String with the name of the referenced table.

setSecondaryTable

public void setSecondaryTable(java.lang.String secondaryTable)
This method sets the name of the referenced table of the Foreign key.

Parameters:
secondaryTable - String with the name of the referenced table.

toString

public java.lang.String toString()
This method returns the SQL Statement to add a Foreign Key constraint to a database table. Returns a String with the SQL Statement


Ontimize