[hibernate-dev] TableGenerator missing "not null"

Steve Ebersole steve at hibernate.org
Fri Dec 12 10:21:42 EST 2008


I am surprised that DB2 does not allow nulls and yet forces you to
specify "not null" since it is totally redundant: PK cannot be null on
DB2 by definition yet it forces user to explicitly specify "not null"

:/

The patch looks fine to me in this case.
 
-  

Steve Ebersole
Project Lead
http://hibernate.org
steve at hibernate.org

Principal Software Engineer
JBoss, a division of Red Hat
http://jboss.com
http://redhat.com
steve.ebersole at jboss.com
steve.ebersole at redhat.com


On Fri, 2008-12-12 at 08:47 -0500, 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