Class SkipNullableUniqueDelegate

  • All Implemented Interfaces:
    UniqueDelegate

    public class SkipNullableUniqueDelegate
    extends CreateTableUniqueDelegate
    A UniqueDelegate that only creates unique constraints on not-null columns, and ignores requests for uniqueness for nullable columns.

    Needed because unique constraints on nullable columns in Sybase always consider null values to be non-unique. There is simply no way to create a unique constraint with the semantics we want on a nullable column in Sybase.

    You might argue that this behavior is bad because if the programmer explicitly specifies an @UniqueKey, then we should damn well respect their wishes. But the simple answer is that the user should have also specified @Column(nullable=false) if that is what they wanted. A unique key on a nullable column just really doesn't make sense in Sybase, except, perhaps, in some incredibly corner cases.