接口 UniqueDelegate
-
public interface UniqueDelegateDialect-level delegate in charge of applying "uniqueness" to a column. Uniqueness can be defined in 1 of 3 ways:-
Add a unique constraint via separate alter table statements. See
getAlterTableToAddUniqueKeyCommand(org.hibernate.mapping.UniqueKey, org.hibernate.boot.Metadata). Also, seegetAlterTableToDropUniqueKeyCommand(org.hibernate.mapping.UniqueKey, org.hibernate.boot.Metadata) -
Add a unique constraint via dialect-specific syntax in table create statement. See
getTableCreationUniqueConstraintsFragment(org.hibernate.mapping.Table) -
Add "unique" syntax to the column itself. See
getColumnDefinitionUniquenessFragment(org.hibernate.mapping.Column)
- 作者:
- Brett Meyer
-
Add a unique constraint via separate alter table statements. See
-
-
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 StringgetAlterTableToAddUniqueKeyCommand(UniqueKey uniqueKey, Metadata metadata)Get the SQL ALTER TABLE command to be used to create the given UniqueKey.StringgetAlterTableToDropUniqueKeyCommand(UniqueKey uniqueKey, Metadata metadata)Get the SQL ALTER TABLE command to be used to drop the given UniqueKey.StringgetColumnDefinitionUniquenessFragment(Column column)Get the fragment that can be used to make a column unique as part of its column definition.StringgetTableCreationUniqueConstraintsFragment(Table table)Get the fragment that can be used to apply unique constraints as part of table creation.
-
-
-
方法详细资料
-
getColumnDefinitionUniquenessFragment
String getColumnDefinitionUniquenessFragment(Column column)
Get the fragment that can be used to make a column unique as part of its column definition. This is intended for dialects which do not support unique constraints- 参数:
column- The column to which to apply the unique- 返回:
- The fragment (usually "unique"), empty string indicates the uniqueness will be indicated using a different approach
-
getTableCreationUniqueConstraintsFragment
String getTableCreationUniqueConstraintsFragment(Table table)
Get the fragment that can be used to apply unique constraints as part of table creation. The implementation should iterate over theUniqueKeyinstances for the given table (seeTable.getUniqueKeyIterator()and generate the whole fragment for all unique keys Intended for Dialects which support unique constraint definitions, but just not in separate ALTER statements.- 参数:
table- The table for which to generate the unique constraints fragment- 返回:
- The fragment, typically in the form
", unique(col1, col2), unique( col20)". NOTE: The leading comma is important!
-
getAlterTableToAddUniqueKeyCommand
String getAlterTableToAddUniqueKeyCommand(UniqueKey uniqueKey, Metadata metadata)
Get the SQL ALTER TABLE command to be used to create the given UniqueKey.- 参数:
uniqueKey- The UniqueKey instance. Contains all information about the columnsmetadata- Access to the bootstrap mapping information- 返回:
- The ALTER TABLE command
-
getAlterTableToDropUniqueKeyCommand
String getAlterTableToDropUniqueKeyCommand(UniqueKey uniqueKey, Metadata metadata)
Get the SQL ALTER TABLE command to be used to drop the given UniqueKey.- 参数:
uniqueKey- The UniqueKey instance. Contains all information about the columnsmetadata- Access to the bootstrap mapping information- 返回:
- The ALTER TABLE command
-
-