title: uniqueness of composite id with null component
body: <p>I am running into problems using unique constraints.
  The following combinations are allowed</p>
  
  <pre><code>A.name  B.name
  foo     NULL
  foo     bar
  foo     bar1
  foo1    bar
  </code></pre>
  
  <p>It should not be possible to create a new A with same name, only if it has a different B.
  With the constraints below it is possible to create</p>
  
  <pre><code>A.name B.name
  foo    NULL
  foo    NULL
  </code></pre>
  
  <p>Because NULL seems not to have effect on unique. </p>
  
  <p>Any hints how to fix this?</p>
  
  <pre><code>class A {
    String name
    static belongsTo = [b:B]
    static constraints = {
      name(unique:'b')
      b(nullable:true)
    }
  }
  
  class B {
    String name
    static hasMany = [as:A]
    name(unique:true)
  }
  </code></pre>