Package org.hibernate.mapping
Class Constraint
- java.lang.Object
-
- org.hibernate.mapping.Constraint
-
- All Implemented Interfaces:
Serializable
,Exportable
- Direct Known Subclasses:
ForeignKey
,PrimaryKey
,UniqueKey
public abstract class Constraint extends Object implements Exportable, Serializable
A mapping model object representing a constraint on a relational database table.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Constraint()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addColumn(Column column)
void
addColumns(Value value)
boolean
containsColumn(Column column)
abstract String
generatedConstraintNamePrefix()
Deprecated, for removal: This API element is subject to removal in a future version.No longer used, should be removedstatic String
generateName(String prefix, Table table, List<Column> columns)
Deprecated, for removal: This API element is subject to removal in a future version.This method does not respect theImplicitNamingStrategy
static String
generateName(String prefix, Table table, Column... columns)
Deprecated, for removal: This API element is subject to removal in a future version.This method does not respect theImplicitNamingStrategy
Column
getColumn(int i)
List<Column>
getColumns()
int
getColumnSpan()
String
getName()
Table
getTable()
static String
hashedName(String name)
Deprecated, for removal: This API element is subject to removal in a future version.Only used from deprecated methodsboolean
isGenerated(Dialect dialect)
Deprecated, for removal: This API element is subject to removal in a future version.No longer usedvoid
setName(String name)
void
setTable(Table table)
abstract String
sqlConstraintString(SqlStringGenerationContext context, String constraintName, String defaultCatalog, String defaultSchema)
Deprecated, for removal: This API element is subject to removal in a future version.this method is no longer calledString
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hibernate.boot.model.relational.Exportable
getExportIdentifier
-
-
-
-
Method Detail
-
getName
public String getName()
-
setName
public void setName(String name)
-
generateName
@Deprecated(since="6.5", forRemoval=true) public static String generateName(String prefix, Table table, Column... columns)
Deprecated, for removal: This API element is subject to removal in a future version.This method does not respect theImplicitNamingStrategy
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.- Returns:
- String The generated name
-
generateName
@Deprecated(since="6.5", forRemoval=true) public static String generateName(String prefix, Table table, List<Column> columns)
Deprecated, for removal: This API element is subject to removal in a future version.This method does not respect theImplicitNamingStrategy
Helper method forgenerateName(String, Table, Column...)
.- Returns:
- String The generated name
-
hashedName
@Deprecated(since="6.5", forRemoval=true) public static String hashedName(String name)
Deprecated, for removal: This API element is subject to removal in a future version.Only used from deprecated methodsHash 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.- Parameters:
name
- The name to be hashed.- Returns:
- String The hashed name.
-
addColumn
public void addColumn(Column column)
-
addColumns
public void addColumns(Value value)
-
containsColumn
public boolean containsColumn(Column column)
- Returns:
- true if this constraint already contains a column with same name.
-
getColumnSpan
public int getColumnSpan()
-
getColumn
public Column getColumn(int i)
-
getTable
public Table getTable()
-
setTable
public void setTable(Table table)
-
isGenerated
@Deprecated(forRemoval=true) public boolean isGenerated(Dialect dialect)
Deprecated, for removal: This API element is subject to removal in a future version.No longer used
-
sqlConstraintString
@Deprecated(since="6.2", forRemoval=true) public abstract String sqlConstraintString(SqlStringGenerationContext context, String constraintName, String defaultCatalog, String defaultSchema)
Deprecated, for removal: This API element is subject to removal in a future version.this method is no longer called
-
generatedConstraintNamePrefix
@Deprecated(since="6.5", forRemoval=true) public abstract String generatedConstraintNamePrefix()
Deprecated, for removal: This API element is subject to removal in a future version.No longer used, should be removed- Returns:
- String The prefix to use in generated constraint names. Examples: "UK_", "FK_", and "PK_".
-
-