[hibernate-dev] TableGenerator missing "not null"

Chris Bredesen cbredesen at redhat.com
Fri Dec 12 12:18:18 EST 2008


Juraci Costa wrote:
> ----- "Chris Bredesen" <cbredesen at redhat.com> escreveu:
>> The not null constraint is redundant in Oracle and possibly others;
>> you 
>> wind up with two constraints on the table if you specify PK & not
>> null. 
> 
> I don't think so. I tested in our QA lab in both Oracle 9i and 10g. Only one constraint and only one index. This may be true for other databases (I can verify in all the supported), but even if this is the case, would it cause much harm?

Maybe that's the case now.  I took a ton of flack from my Oracle DBA a 
couple years ago for giving him Hibernate generated scripts that 
included both PK and not null. :)

>>   Perhaps we need an attribute on the Dialect for this...
> 
> Like "getNotNullStringForPK()" returning "not null"/"" or "needsNotNullInPK()" returning true/false ? What should be the default in Dialect? 

If it's no longer an issue then I would definitely not pollute the Dialect.

> By the way, let me know when you come to Brno. I'm in debt with you :-) 

I'll take you up on it if ever I'm out that way!

-Chris



More information about the hibernate-dev mailing list