Uploaded image for project: 'Hibernate ORM'
  1. Hibernate ORM
  2. HHH-7797

Inconsistent logic by uses of Dialect#supportsNotNullUnique


    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.1.8, 4.3.0.Beta1
    • Fix Version/s: 4.2.0.CR1, 4.1.10, 4.3.0.Beta1
    • Component/s: None
    • Labels:
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:


      Dialect#supportsNotNullUnique is used by 2 areas:

      1.) Table. Prevents "not null unique" if supportsNotNullUnique is false and the column is not nullable.
      2.) UniqueKey. The logic is reversed from #1. Appears to prevent unique constraints from being created if supportsNotNullUnique is false and one of the constraint's columns is nullable.

      The uses seem inconsistent and incorrect.

      This came about through HHH-5376 - Tests contain invalid SQL Complete , HHH-7579 - Oracle does not support "unique not null" Complete , and HHH-7578 - Sybase does not support "unique not null" Complete . Some dialects appear to differ in their support of "unique not null" and unique constraints on nullable fields. The sole use of supportsNotNullUnique probably won't cut it.

      Test case: o.h.test.collection.map.hhh7557.EntityMapTest. All entities have primary keys and explicitly define them as unique and not nullable. The test fails on Oracle as it attempts to use "not null unique" on the column, as well as create a primary key constraint.


          Issue Links



              • Votes:
                4 Vote for this issue
                10 Start watching this issue


                • Created: