db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Letness <ra...@osafoundation.org>
Subject Re: unique columns must be nullable ?
Date Wed, 13 Dec 2006 02:42:15 GMT
Mike Matrigali wrote:
> Out of curiousity what behavior does Hibernate expect when 2 nulls are 
> inserted into a "unique" nullable column?
>
>

When you specify a unique constraint in hibernate, I'm pretty sure its 
only used by the schema export tools to generate a unique constraint 
when generating the DDL statements.  That is, it doesn't care if you 
insert 2 nulls, it relies on the database to throw an exception.  Things 
break when hibernate tries to generate a unique constraint on nullable 
columns in Derby.  I guess its not smart enough to realize Derby (or any 
other db) doesn't support this.  I have run into the same problem as I 
am working on a project that supports both MySQL and Derby and MySQL 
supports constraints on nullable columns, while Derby doesn't.

-Randy

Mime
View raw message