Hibernate version:
3.2.6 ga
Mapping documents:
<property name="resume" length="512" not-null="true" />
Name and version of the database you are using:
MySQL 5.0 with MySQL5InnoDBDialect
Hello
I validate my schema with org.hibernate.tool.hbm2ddl.SchemaValidator
It works OK, but it does not check for column length or null/not-null constraints.
For example, if I manually change the type of the field from varchar to text, I get this nice exception:
Code:
SEVERE: Error running schema update
org.hibernate.HibernateException: Wrong column type in foobar.students for column resume. Found: text, expected: varchar(512)
at org.hibernate.mapping.Table.validateColumns(Table.java:261)
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1089)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:116)
at org.hibernate.tool.hbm2ddl.SchemaValidator.main(SchemaValidator.java:85)
But if field is different in any other aspect (length, or allowing null) the validator does not inform me.
Couldn't the org.hibernate.mapping.Table be enhanced on line 257 by adding columnInfo.getColumnSize() and columnInfo.getNullable() checks?
Is there a reason why this hasn't been implemented?
thanks