Hello,
First, as always: Kudos to Hibernate team. Thanks for great project.
I've experienced a problem with a few versions of Hibernate 2.1.x. When adding a boolean field to a MySQL table with a not-null value set to true, the ddl comes out as:
alter table tablename add column booleancolumn BIT
leaving off the "NOT NULL"
Finally motivated to go a little deeper, I went into the src for the Table class and changed some code to include this. My question is: is this likely to cause any negative effects that aren't immediately obvious? I'm not too concerned about database independence for this particular product.
Thanks in advance.
Reid
code is from net.st.hibernate.mapping.Table.sqlAlterStrings v 2.1.2
Code:
if (columnInfo==null) {
// the column doesnt exist at all.
StringBuffer alter = new StringBuffer( root.toString() )
.append(' ')
.append( col.getQuotedName(dialect) )
.append(' ')
.append( col.getSqlType(dialect, p) );
if ( col.isUnique() && dialect.supportsUnique() ) {
alter.append(" unique");
}
// I added from here...
if ( !col.isNullable()) {
alter.append(" NOT NULL ");
}
//...to here
if ( col.hasCheckConstraint() ) {
alter.append(" check(")
.append( col.getCheckConstraint() )
.append(")");
}
results.add( alter.toString() );
}