JavaScript is disabled on your browser.
All Known Implementing Classes:
Check , ForeignKey , PrimaryKey , Unique
@Evolving
public interface Constraint
A constraint that restricts states of data in a table.
Since:
4.1.0
Nested Class Summary
Nested Classes
static enum
An indicator of the validity of the constraint.
Method Summary
All Methods Static Methods Instance Methods Abstract Methods
Instantiates a builder for a CHECK constraint.
boolean
Indicates whether this constraint is actively enforced.
Instantiates a builder for a FOREIGN KEY constraint.
Returns the name of this constraint.
Instantiates a builder for a PRIMARY KEY constraint.
boolean
Indicates whether this constraint is assumed to hold true if the validity is unknown.
Returns the definition of this constraint in the DDL format.
Returns the constraint description for DESCRIBE TABLE output, excluding the constraint
name (shown separately).
Instantiates a builder for a UNIQUE constraint.
Indicates whether the existing data in the table satisfies this constraint.
Method Details
name
Returns the name of this constraint.
enforced
boolean enforced ()
Indicates whether this constraint is actively enforced. If enforced, data modifications
that violate the constraint fail with a constraint violation error.
validationStatus
Indicates whether the existing data in the table satisfies this constraint. The constraint
can be valid (the data is guaranteed to satisfy the constraint), invalid (some records violate
the constraint), or unvalidated (the validity is unknown). The validation status is usually
managed by the system and can't be modified by the user.
rely
boolean rely ()
Indicates whether this constraint is assumed to hold true if the validity is unknown. Unlike
the validation status, this flag is usually provided by the user as a hint to the system.
toDDL
Returns the definition of this constraint in the DDL format.
toDescription
Returns the constraint description for DESCRIBE TABLE output, excluding the constraint
name (shown separately).
check
Instantiates a builder for a CHECK constraint.
Parameters:
name - the constraint name
Returns:
a CHECK constraint builder
unique
Instantiates a builder for a UNIQUE constraint.
Parameters:
name - the constraint name
columns - columns that comprise the unique key
Returns:
a UNIQUE constraint builder
primaryKey
Instantiates a builder for a PRIMARY KEY constraint.
Parameters:
name - the constraint name
columns - columns that comprise the primary key
Returns:
a PRIMARY KEY constraint builder
foreignKey
Instantiates a builder for a FOREIGN KEY constraint.
Parameters:
name - the constraint name
columns - the referencing columns
refTable - the referenced table identifier
refColumns - the referenced columns in the referenced table
Returns:
a FOREIGN KEY constraint builder