public abstract class Constraint extends Object implements RelationalModel, Exportable, Serializable
A relational constraint.
Constructor and Description |
---|
Constraint() |
Modifier and Type | Method and Description |
---|---|
void |
addColumn(Column column) |
void |
addColumns(Iterator columnIterator) |
Iterator<Column> |
columnIterator() |
boolean |
containsColumn(Column column) |
abstract String |
generatedConstraintNamePrefix() |
static String |
generateName(String prefix,
Table table,
Column... columns)
If a constraint is not explicitly named, this is called to generate
a unique hash using the table and column names.
|
static String |
generateName(String prefix,
Table table,
List<Column> columns)
Helper method for
#generateName(String, Table, Column…) . |
Column |
getColumn(int i) |
Iterator<Column> |
getColumnIterator() |
List<Column> |
getColumns() |
int |
getColumnSpan() |
String |
getName() |
Table |
getTable() |
static String |
hashedName(String s)
Hash a constraint name using MD5.
|
boolean |
isGenerated(Dialect dialect) |
void |
setName(String name) |
void |
setTable(Table table) |
abstract String |
sqlConstraintString(Dialect d,
String constraintName,
String defaultCatalog,
String defaultSchema) |
String |
sqlCreateString(Dialect dialect,
Mapping p,
String defaultCatalog,
String defaultSchema) |
String |
sqlDropString(Dialect dialect,
String defaultCatalog,
String defaultSchema) |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getExportIdentifier
public String getName()
public void setName(String name)
public static String generateName(String prefix, Table table, Column... columns)
If a constraint is not explicitly named, this is called to generate a unique hash using the table and column names. Static so the name can be generated prior to creating the Constraint. They’re cached, keyed by name, in multiple locations.
public static String generateName(String prefix, Table table, List<Column> columns)
Helper method for #generateName(String, Table, Column…)
.
public static String hashedName(String s)
Hash a constraint name using MD5. Convert the MD5 digest to base 35 (full alphanumeric), guaranteeing that the length of the name will always be smaller than the 30 character identifier restriction enforced by a few dialects.
s
- The name to be hashed.public void addColumn(Column column)
public void addColumns(Iterator columnIterator)
public boolean containsColumn(Column column)
public int getColumnSpan()
public Column getColumn(int i)
public Table getTable()
public void setTable(Table table)
public boolean isGenerated(Dialect dialect)
public String sqlDropString(Dialect dialect, String defaultCatalog, String defaultSchema)
sqlDropString
in interface RelationalModel
public String sqlCreateString(Dialect dialect, Mapping p, String defaultCatalog, String defaultSchema)
sqlCreateString
in interface RelationalModel
public abstract String sqlConstraintString(Dialect d, String constraintName, String defaultCatalog, String defaultSchema)
public abstract String generatedConstraintNamePrefix()
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.