Package org.hibernate.dialect.unique
Class AlterTableUniqueIndexDelegate
java.lang.Object
org.hibernate.dialect.unique.AlterTableUniqueDelegate
org.hibernate.dialect.unique.AlterTableUniqueIndexDelegate
- All Implemented Interfaces:
UniqueDelegate
A
UniqueDelegate
which uses create unique index
commands when necessary.
- DB2 does not allow unique constraints on nullable columns, but it does allow the creation
of unique indexes instead, using
create unique index ... exclude null keys
orcreate unique where not null index
, depending on flavor. - SQL Server does allow unique constraints on nullable columns, but the semantics
are that two null values are non-unique. So here we need to jump through hoops with the
create unique nonclustered index ... where ...
command.
-
Field Summary
Fields inherited from class org.hibernate.dialect.unique.AlterTableUniqueDelegate
dialect
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAlterTableToAddUniqueKeyCommand
(UniqueKey uniqueKey, Metadata metadata, SqlStringGenerationContext context) Get thealter table
command used to create the given unique key constraint, or return the empty string if the constraint was already included in thecreate table
statement byUniqueDelegate.getTableCreationUniqueConstraintsFragment(org.hibernate.mapping.Table, org.hibernate.boot.model.relational.SqlStringGenerationContext)
.getAlterTableToDropUniqueKeyCommand
(UniqueKey uniqueKey, Metadata metadata, SqlStringGenerationContext context) Get thealter table
command used to drop the given unique key which was previously created byUniqueDelegate.getAlterTableToAddUniqueKeyCommand(org.hibernate.mapping.UniqueKey, org.hibernate.boot.Metadata, org.hibernate.boot.model.relational.SqlStringGenerationContext)
.Methods inherited from class org.hibernate.dialect.unique.AlterTableUniqueDelegate
getColumnDefinitionUniquenessFragment, getTableCreationUniqueConstraintsFragment, uniqueConstraintSql
-
Constructor Details
-
AlterTableUniqueIndexDelegate
-
-
Method Details
-
getAlterTableToAddUniqueKeyCommand
public String getAlterTableToAddUniqueKeyCommand(UniqueKey uniqueKey, Metadata metadata, SqlStringGenerationContext context) Description copied from interface:UniqueDelegate
Get thealter table
command used to create the given unique key constraint, or return the empty string if the constraint was already included in thecreate table
statement byUniqueDelegate.getTableCreationUniqueConstraintsFragment(org.hibernate.mapping.Table, org.hibernate.boot.model.relational.SqlStringGenerationContext)
.- Specified by:
getAlterTableToAddUniqueKeyCommand
in interfaceUniqueDelegate
- Overrides:
getAlterTableToAddUniqueKeyCommand
in classAlterTableUniqueDelegate
- Parameters:
uniqueKey
- TheUniqueKey
instance. Contains all information about the columnsmetadata
- Access to the bootstrap mapping informationcontext
- A context for SQL string generation- Returns:
- The
alter table
command
-
getAlterTableToDropUniqueKeyCommand
public String getAlterTableToDropUniqueKeyCommand(UniqueKey uniqueKey, Metadata metadata, SqlStringGenerationContext context) Description copied from interface:UniqueDelegate
Get thealter table
command used to drop the given unique key which was previously created byUniqueDelegate.getAlterTableToAddUniqueKeyCommand(org.hibernate.mapping.UniqueKey, org.hibernate.boot.Metadata, org.hibernate.boot.model.relational.SqlStringGenerationContext)
.- Specified by:
getAlterTableToDropUniqueKeyCommand
in interfaceUniqueDelegate
- Overrides:
getAlterTableToDropUniqueKeyCommand
in classAlterTableUniqueDelegate
- Parameters:
uniqueKey
- TheUniqueKey
instance. Contains all information about the columnsmetadata
- Access to the bootstrap mapping informationcontext
- A context for SQL string generation- Returns:
- The
alter table
command
-