Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.solarmetric.rd.kodo.impl.jdbc.schema
Class ForeignKey

    java.lang.Object
      |
      +--com.solarmetric.rd.kodo.impl.jdbc.schema.ReferenceCounter
            |
            +--com.solarmetric.rd.kodo.impl.jdbc.schema.Constraint
                  |
                  +--com.solarmetric.rd.kodo.impl.jdbc.schema.ForeignKey

public class ForeignKey
extends Constraint

Represents a database foreign key; may be a logical key with no database representation.

Field Summary
`static int` | `ACTION_CASCADE` Cascade any modification of the joined primary key columns to this table.
`static int` | `ACTION_DEFAULT` Set the local columns to their default values if the primary key columns are modified.
`static int` | `ACTION_EXCEPTION` Throw an exception if joined primary key columns are modified.
`static int` | `ACTION_NONE` Logical foreign key; links columns, but does not perform any action when the joined primary key columns are modified.
`static int` | `ACTION_NULL` Null the local columns if the joined primary key columns are modified.

Method Summary
`boolean` | `columnsMatch(com.solarmetric.rd.kodo.impl.jdbc.schema.Column[] fkCols, com.solarmetric.rd.kodo.impl.jdbc.schema.Column[] fkPKCols)` Return true if the given local and foreign columns match those on this key.
`boolean` | `containsColumn(com.solarmetric.rd.kodo.impl.jdbc.schema.Column col)` Return true if the fk includes the given local column.
`boolean` | `containsPrimaryKeyColumn(com.solarmetric.rd.kodo.impl.jdbc.schema.Column col)` Return true if the fk includes the given primary key column.
`void` | `derefColumns()` Deref all columns in this key.
`boolean` | `equals(java.lang.Object other)` Foreign keys are equal if the satisfy the equality constraints of `Constraint` and they have the same local and primary key columns and action.
`com.solarmetric.rd.kodo.impl.jdbc.schema.Column` | `getColumn(com.solarmetric.rd.kodo.impl.jdbc.schema.Column pk)` Return the local column joined to the given primary key column.
`com.solarmetric.rd.kodo.impl.jdbc.schema.Column[]` | `getColumns()` Return the local columns in the foreign key local table order.
`com.solarmetric.rd.kodo.impl.jdbc.schema.Column[]` | `getColumns(com.solarmetric.rd.kodo.impl.jdbc.schema.Column[] customPks)` Return the local columns in join-order with the given primary key columns.
`int` | `getDeleteAction()` Return the delete action for the key.
`int` | `getIndex()` Return the foreign key's 0-based index in the owning table.
`com.solarmetric.rd.kodo.impl.jdbc.schema.PrimaryKey` | `getPrimaryKey()` Returns the primary key this foreign key is linking to, if it is known yet.
`com.solarmetric.rd.kodo.impl.jdbc.schema.Column` | `getPrimaryKeyColumn(com.solarmetric.rd.kodo.impl.jdbc.schema.Column local)` Return the primary key column joined to the given local column.
`com.solarmetric.rd.kodo.impl.jdbc.schema.Column[]` | `getPrimaryKeyColumns()` Return the foreign columns in the foreign key, in join-order with the result of `getColumns()`.
`com.solarmetric.rd.kodo.impl.jdbc.schema.Column[]` | `getPrimaryKeyColumns(com.solarmetric.rd.kodo.impl.jdbc.schema.Column[] customLocals)` Return the primary key columns in join-order with the given local columns.
`boolean` | `isLogical()` Return whether this constraint is a logical constraint only; i.e.
`void` | `join(com.solarmetric.rd.kodo.impl.jdbc.schema.Column local, com.solarmetric.rd.kodo.impl.jdbc.schema.Column toPK)` Join a local column to a primary key column of another table.
`void` | `refColumns()` Ref all columns in this key.
`boolean` | `removeJoin(com.solarmetric.rd.kodo.impl.jdbc.schema.Column local)` Remove the join for the given local column.
`void` | `setDeleteAction(int action)` Set the delete action for the key.
`void` | `setJoins(com.solarmetric.rd.kodo.impl.jdbc.schema.Column[] cols, com.solarmetric.rd.kodo.impl.jdbc.schema.Column[] pkCols)` Set the foreign key's joins.

Methods inherited from class com.solarmetric.rd.kodo.impl.jdbc.schema.Constraint
`getName, getTable, isDeferred, setDeferred, toString`

Methods inherited from class com.solarmetric.rd.kodo.impl.jdbc.schema.ReferenceCounter
`deref, getRefCount, ref`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### ACTION_NONE

    public static final int ACTION_NONE

  Logical foreign key; links columns, but does not perform any action when the joined primary key columns are modified.

  See Also:
    Constant Field Values

### ACTION_EXCEPTION

    public static final int ACTION_EXCEPTION

  Throw an exception if joined primary key columns are modified.

  See Also:
    Constant Field Values

### ACTION_CASCADE

    public static final int ACTION_CASCADE

  Cascade any modification of the joined primary key columns to this table. If the joined primary key row is deleted, the row in this table will also be deleted.

  See Also:
    Constant Field Values

### ACTION_NULL

    public static final int ACTION_NULL

  Null the local columns if the joined primary key columns are modified.

  See Also:
    Constant Field Values

### ACTION_DEFAULT

    public static final int ACTION_DEFAULT

  Set the local columns to their default values if the primary key columns are modified.

  See Also:
    Constant Field Values

Method Detail

### isLogical

    public boolean isLogical()

  Description copied from class: `Constraint`
  Return whether this constraint is a logical constraint only; i.e. if it does not exist in the database.

  Specified by:
    `isLogical` in class `Constraint`

### getDeleteAction

    public int getDeleteAction()

  Return the delete action for the key. Will be one of: `ACTION_NONE`, `ACTION_EXCEPTION`, `ACTION_CASCADE`, `ACTION_NULL`, `ACTION_DEFAULT`.

### setDeleteAction

    public void setDeleteAction(int action)

  Set the delete action for the key. Must be one of: `ACTION_NONE`, `ACTION_EXCEPTION`, `ACTION_CASCADE`, `ACTION_NULL`, `ACTION_DEFAULT`.

### getIndex

    public int getIndex()

  Return the foreign key's 0-based index in the owning table.

### getPrimaryKeyColumn

    public com.solarmetric.rd.kodo.impl.jdbc.schema.Column getPrimaryKeyColumn(com.solarmetric.rd.kodo.impl.jdbc.schema.Column local)

  Return the primary key column joined to the given local column.

### getColumn

    public com.solarmetric.rd.kodo.impl.jdbc.schema.Column getColumn(com.solarmetric.rd.kodo.impl.jdbc.schema.Column pk)

  Return the local column joined to the given primary key column.

### getColumns

    public com.solarmetric.rd.kodo.impl.jdbc.schema.Column[] getColumns()

  Return the local columns in the foreign key local table order.

### getColumns

    public com.solarmetric.rd.kodo.impl.jdbc.schema.Column[] getColumns(com.solarmetric.rd.kodo.impl.jdbc.schema.Column[] customPks)

  Return the local columns in join-order with the given primary key columns.

### containsColumn

    public boolean containsColumn(com.solarmetric.rd.kodo.impl.jdbc.schema.Column col)

  Return true if the fk includes the given local column.

### containsPrimaryKeyColumn

    public boolean containsPrimaryKeyColumn(com.solarmetric.rd.kodo.impl.jdbc.schema.Column col)

  Return true if the fk includes the given primary key column.

### getPrimaryKeyColumns

    public com.solarmetric.rd.kodo.impl.jdbc.schema.Column[] getPrimaryKeyColumns()

  Return the foreign columns in the foreign key, in join-order with the result of `getColumns()`.

### getPrimaryKeyColumns

    public com.solarmetric.rd.kodo.impl.jdbc.schema.Column[] getPrimaryKeyColumns(com.solarmetric.rd.kodo.impl.jdbc.schema.Column[] customLocals)

  Return the primary key columns in join-order with the given local columns.

### setJoins

    public void setJoins(com.solarmetric.rd.kodo.impl.jdbc.schema.Column[] cols,
                         com.solarmetric.rd.kodo.impl.jdbc.schema.Column[] pkCols)

  Set the foreign key's joins.

### join

    public void join(com.solarmetric.rd.kodo.impl.jdbc.schema.Column local,
                     com.solarmetric.rd.kodo.impl.jdbc.schema.Column toPK)

  Join a local column to a primary key column of another table.

### removeJoin

    public boolean removeJoin(com.solarmetric.rd.kodo.impl.jdbc.schema.Column local)

  Remove the join for the given local column.

  Returns:
    true if the join was removed, false if not part of the key

### getPrimaryKey

    public com.solarmetric.rd.kodo.impl.jdbc.schema.PrimaryKey getPrimaryKey()

  Returns the primary key this foreign key is linking to, if it is known yet.

### refColumns

    public void refColumns()

  Ref all columns in this key.

### derefColumns

    public void derefColumns()

  Deref all columns in this key.

### equals

    public boolean equals(java.lang.Object other)

  Foreign keys are equal if the satisfy the equality constraints of `Constraint` and they have the same local and primary key columns and action.

  Overrides:
    `equals` in class `Constraint`

### columnsMatch

    public boolean columnsMatch(com.solarmetric.rd.kodo.impl.jdbc.schema.Column[] fkCols,
                                com.solarmetric.rd.kodo.impl.jdbc.schema.Column[] fkPKCols)

  Return true if the given local and foreign columns match those on this key. This can be used to find foreign keys given only column linking information.

Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2001,2002,2003 SolarMetric, Inc. All Rights Reserved.