unique to the column definition.
See getColumnDefinitionUniquenessFragment
create table statement.
See getTableCreationUniqueConstraintsFragment
alter table statements.
See getAlterTableToAddUniqueKeyCommand.
Also, see getAlterTableToDropUniqueKeyCommand.
CreateTableUniqueDelegate
where possible. However, for databases where unique constraints may not contain a nullable
column, and unique indexes must be used instead, we use AlterTableUniqueIndexDelegate.
Hibernate specifies that a unique constraint on a nullable column considers null values to be
distinct. Some databases default to the opposite semantic, where null values are considered
equal for the purpose of determining uniqueness. This is almost never useful, and is the
opposite of what we want when we use a unique constraint on a foreign key to map an optional
org. association. Therefore, our UniqueDelegates must
jump through hoops to emulate the sensible semantics specified by ANSI, Hibernate, and common
sense, namely, that two null values are distinct. A particularly egregious offender is Sybase,
where we must simply skip creating the unique constraint.
| Modifier and Type | Method and Description |
|---|---|
| public String | Returns: Thealter table commandThe uniqueKey, Metadata UniqueKey instance. Contains all information about the columnsAccess to the bootstrap mapping information metadata, SqlStringGenerationContext A context for SQL string generation context)
Deprecated
as a consequence of
Get the Metadata being deprecated.
alter table command used to create the given unique key
constraint, or return the empty string if the constraint was already included in the create table statement by getTableCreationUniqueConstraintsFragment.
|
| public String | Returns: Thealter table commandThe uniqueKey, Metadata UniqueKey instance. Contains all information about the columnsAccess to the bootstrap mapping information metadata, SqlStringGenerationContext A context for SQL string generation context)
Deprecated
as a consequence of
Get the Metadata being deprecated.
alter table command used to drop the given unique key
which was previously created by getAlterTableToAddUniqueKeyCommand.
|
| public String | Returns: The fragment (usually "unique"), empty string indicates the uniqueness will be indicated using a different approachThe column to which to apply the unique column, SqlStringGenerationContext A context for SQL string generation context)Get the SQL fragment used to make the given column unique as part of its column definition,
usually just |
| public String | Returns: The fragment, typically in the form", unique(col1, col2), unique(col20)".
The leading comma is important!The table for which to generate the unique constraints fragment table, SqlStringGenerationContext A context for SQL string generation context)Get the SQL fragment used to specify the unique constraints on the given table as part of
the
|
| getAlterTableToAddUniqueKeyCommand | back to summary |
|---|---|
| public String getAlterTableToAddUniqueKeyCommand(UniqueKey uniqueKey, Metadata metadata, SqlStringGenerationContext context)
Deprecated as a consequence of Get the
| |
| getAlterTableToDropUniqueKeyCommand | back to summary |
|---|---|
| public String getAlterTableToDropUniqueKeyCommand(UniqueKey uniqueKey, Metadata metadata, SqlStringGenerationContext context)
Deprecated as a consequence of Get the
| |
| getColumnDefinitionUniquenessFragment | back to summary |
|---|---|
| public String getColumnDefinitionUniquenessFragment(Column column, SqlStringGenerationContext context) Get the SQL fragment used to make the given column unique as part of its column definition,
usually just This is for handling single columns explicitly marked unique, not for dealing with unique keys.
| |
| getTableCreationUniqueConstraintsFragment | back to summary |
|---|---|
| public String getTableCreationUniqueConstraintsFragment(Table table, SqlStringGenerationContext context) Get the SQL fragment used to specify the unique constraints on the given table as part of
the
or return an empty string if there are no unique constraints or if the unique constraints do not belong in the table definition.
The implementation should iterate over the unique keys of the given
table by calling
| |