Hibernate to update table schema
I am using hibernate 3.*. I want to update table's one column length from 255 to 512. Table has data already. I have tried "hbm2ddl.auto=update" but I gives me error like : ERROR JDBCExceptionRe开发者_开发知识库porter : String or binary data would be truncated. 12 May 2011 19:49:37,265 WARN DefaultMetricsRepository : Encountered error while closing Hibernate session org.hibernate.PropertyValueException: not-null property references a null or transient value:
Alas, hibernate can't alter columns. I also wish it could, but it doesn't. So you will have to manually alter it.
I guess you can write something to plug in the schema update code so that ALTER
queries are executed.
精彩评论