org.apache.openjpa.jdbc.schema
Class PrimaryKey

java.lang.Object
  extended by org.apache.openjpa.jdbc.schema.Constraint
      extended by org.apache.openjpa.jdbc.schema.LocalConstraint
          extended by org.apache.openjpa.jdbc.schema.PrimaryKey
All Implemented Interfaces:
Serializable

public class PrimaryKey
extends LocalConstraint

Represents a table primary key. It can also represent a partial key, aligning with the key information available from DatabaseMetaData.

Author:
Abe White
See Also:
Serialized Form

Constructor Summary
PrimaryKey()
          Default constructor.
PrimaryKey(DBIdentifier name, Table table)
           
PrimaryKey(String name, Table table)
          Deprecated.  
 
Method Summary
 void addColumn(Column col)
          Add a column to the constraint.
 void deref()
           
 boolean equalsPrimaryKey(PrimaryKey pk)
          Return true if the structure of this primary key matches that of the given one (same table, same columns).
 int getRefCount()
           
 boolean isLogical()
          Return whether this constraint is a logical constraint only; i.e.
 void ref()
           
 void setLogical(boolean logical)
           
 
Methods inherited from class org.apache.openjpa.jdbc.schema.LocalConstraint
columnsMatch, containsColumn, derefColumns, equalsLocalConstraint, getColumns, refColumns, removeColumn, setColumns
 
Methods inherited from class org.apache.openjpa.jdbc.schema.Constraint
getColumnIdentifier, getColumnName, getFullIdentifier, getFullName, getIdentifier, getName, getQualifiedPath, getSchemaIdentifier, getSchemaName, getTable, getTableIdentifier, getTableName, isDeferred, setColumnIdentifier, setColumnName, setDeferred, setIdentifier, setName, setSchemaIdentifier, setSchemaName, setTableIdentifier, setTableName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PrimaryKey

public PrimaryKey()
Default constructor.


PrimaryKey

public PrimaryKey(String name,
                  Table table)
Deprecated. 

Constructor.

Parameters:
name - the name of the primary key, if any
table - the table of the primary key

PrimaryKey

public PrimaryKey(DBIdentifier name,
                  Table table)
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

setLogical

public void setLogical(boolean logical)

addColumn

public void addColumn(Column col)
Description copied from class: LocalConstraint
Add a column to the constraint.

Overrides:
addColumn in class LocalConstraint

equalsPrimaryKey

public boolean equalsPrimaryKey(PrimaryKey pk)
Return true if the structure of this primary key matches that of the given one (same table, same columns).


getRefCount

public int getRefCount()

ref

public void ref()

deref

public void deref()


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.