I had the same problem described here. I took a look at the DerbyTenSix dialect and saw it extends Db2Dialect, which uses Db2UniqueDelegate. What it seems to do is, when any of the columns specified for the unique constraint is nullable, it generates an index instead of a constraint. What I did for my project is to create a new Dialect extending DerbyTenSix which uses DefaultUniqueDelegate instead of Db2UniqueDelegate, and it worked like a charm. Even though I took a look to the Derby Reference Manual to see if this approach could be wrong, I am no Derby or even database expert. I hope it helps |