[hibernate-dev] TableGenerator missing "not null"

Chris Bredesen cbredesen at redhat.com
Fri Dec 12 09:30:25 EST 2008

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. 
  Perhaps we need an attribute on the Dialect for this...


Juraci Costa wrote:
> Guys,
> As suggested in a previous topic, I'll pay a genuine Czech beer in any pub in Brno for whoever reviews the patch in HHH-3650[1] (or Moravian wine, if you prefer) :-)
> The class org.hibernate.id.enhanced.TableGenerator is used to generate tables which acts as sequences. In the method sqlCreateStrings(), it builds a create-table statement, but the primary key column specified by the property "segmentColumnName" is not being marked as "not-null", causing DB2 (and probably others) to throw an exception. So, the patch adds a "not null" in the statement, but I'm wondering if I should get the "not null" string from somewhere else. I suspected that Dialect would have it, but only have for "nullable" columns. I believe that "not null" is quite standard, and doesn't requires the abstraction, but maybe you have another idea :-)
> - Juca.
> [1] http://opensource.atlassian.com/projects/hibernate/browse/HHH-3650
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev

More information about the hibernate-dev mailing list