java - set length is not working in hibernate when table is already created -
employeedesc column on employeedetails table has default length of varchar(255). want altered. have tried giving customised length on persistent class.
@entity public class employeedetails { @id private int employeeid; private string employeename; private int employeeage; @column (length = 500) private string employeedesc; // getters , setters }
and hibernate configuration.
<property name="hbm2ddl.auto">update</property>
if tried give value more 255 field employeedesc, getting error saying
caused by: com.mysql.jdbc.mysqldatatruncation: data truncation: data long column 'employeedesc' @ row 1
is there better way alter employeedesc's length without changing "hbm2ddl.auto">update property?
hibernate doesn't update column length during updating/validation. can try use liquibase. not sure able use hibernate update
liquibase
.
Comments
Post a Comment