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 keysorcreate 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 tablecommand used to create the given unique key constraint, or return the empty string if the constraint was already included in thecreate tablestatement byUniqueDelegate.getTableCreationUniqueConstraintsFragment(org.hibernate.mapping.Table, org.hibernate.boot.model.relational.SqlStringGenerationContext).getAlterTableToDropUniqueKeyCommand(UniqueKey uniqueKey, Metadata metadata, SqlStringGenerationContext context) Get thealter tablecommand 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:UniqueDelegateGet thealter tablecommand used to create the given unique key constraint, or return the empty string if the constraint was already included in thecreate tablestatement byUniqueDelegate.getTableCreationUniqueConstraintsFragment(org.hibernate.mapping.Table, org.hibernate.boot.model.relational.SqlStringGenerationContext).- Specified by:
getAlterTableToAddUniqueKeyCommandin interfaceUniqueDelegate- Overrides:
getAlterTableToAddUniqueKeyCommandin classAlterTableUniqueDelegate- Parameters:
uniqueKey- TheUniqueKeyinstance. Contains all information about the columnsmetadata- Access to the bootstrap mapping informationcontext- A context for SQL string generation- Returns:
- The
alter tablecommand
-
getAlterTableToDropUniqueKeyCommand
public String getAlterTableToDropUniqueKeyCommand(UniqueKey uniqueKey, Metadata metadata, SqlStringGenerationContext context) Description copied from interface:UniqueDelegateGet thealter tablecommand 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:
getAlterTableToDropUniqueKeyCommandin interfaceUniqueDelegate- Overrides:
getAlterTableToDropUniqueKeyCommandin classAlterTableUniqueDelegate- Parameters:
uniqueKey- TheUniqueKeyinstance. Contains all information about the columnsmetadata- Access to the bootstrap mapping informationcontext- A context for SQL string generation- Returns:
- The
alter tablecommand
-