Package org.apache.openjpa.jdbc.schema
Class LocalConstraint
java.lang.Object
org.apache.openjpa.jdbc.schema.Constraint
org.apache.openjpa.jdbc.schema.LocalConstraint
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
Index
,PrimaryKey
,Unique
Constraint over local table columns, as opposed to a foreign key which
spans tables. Column APIs can represent a full constraint or a partial
constraint, aligning with
DatabaseMetaData
.- Author:
- Abe White
- See Also:
-
Constructor Summary
ConstructorDescriptionDefault constructor.LocalConstraint
(String name, Table table) Deprecated.LocalConstraint
(DBIdentifier name, Table table) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a column to the constraint.boolean
columnsMatch
(Column[] ocols) Return true if the given columns match the columns of this constraint.boolean
containsColumn
(Column col) Return true if the pk includes the given column.void
deref()
void
Deref all columns in this constraint.protected boolean
Return true if the columns of this constraint matches that of the given one.Column[]
Return all the columns the constraint spans.int
void
ref()
void
Ref all columns in this constraint.boolean
removeColumn
(Column col) Remove a column from the constraint.void
setColumns
(Column[] cols) Set the columns the constraint spans.Methods inherited from class org.apache.openjpa.jdbc.schema.Constraint
equals, getColumnIdentifier, getColumnName, getFullIdentifier, getFullName, getIdentifier, getName, getQualifiedPath, getSchemaIdentifier, getSchemaName, getTable, getTableIdentifier, getTableName, hashCode, isDeferred, isLogical, setColumnIdentifier, setColumnName, setDeferred, setIdentifier, setName, setSchemaIdentifier, setSchemaName, setTableIdentifier, setTableName, toString
-
Constructor Details
-
LocalConstraint
public LocalConstraint()Default constructor. -
LocalConstraint
Deprecated.Constructor.- Parameters:
name
- the name of the constraint, if anytable
- the table of the constraint
-
LocalConstraint
-
-
Method Details
-
getColumns
Return all the columns the constraint spans. -
setColumns
Set the columns the constraint spans. -
addColumn
Add a column to the constraint. -
removeColumn
Remove a column from the constraint.- Returns:
- true if the column was removed, false if not part of the primary key
-
containsColumn
Return true if the pk includes the given column. -
refColumns
public void refColumns()Ref all columns in this constraint. -
derefColumns
public void derefColumns()Deref all columns in this constraint. -
columnsMatch
Return true if the given columns match the columns of this constraint. -
equalsLocalConstraint
Return true if the columns of this constraint matches that of the given one. The constraints are not compared on name. -
getRefCount
public int getRefCount() -
ref
public void ref() -
deref
public void deref()
-