Interface UniqueDelegate

    • Method Detail

      • getColumnDefinitionUniquenessFragment

        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 " unique", or return an empty string if uniqueness does not belong in the column definition.

        This is for handling single columns explicitly marked unique, not for dealing with unique keys.

        Parameters:
        column - The column to which to apply the unique
        context - A context for SQL string generation
        Returns:
        The fragment (usually "unique"), empty string indicates the uniqueness will be indicated using a different approach
      • getTableCreationUniqueConstraintsFragment

        String getTableCreationUniqueConstraintsFragment​(Table table,
                                                         SqlStringGenerationContext context)
        Get the SQL fragment used to specify the unique constraints on the given table as part of the create table command, with a leading comma, usually something like:
        , unique(x,y), constraint abc unique(a,b,c)

        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 Table.getUniqueKeys() and generate a fragment which includes all the unique key declarations.

        Parameters:
        table - The table for which to generate the unique constraints fragment
        context - A context for SQL string generation
        Returns:
        The fragment, typically in the form ", unique(col1, col2), unique(col20)". The leading comma is important!