import org.joda.time.DateTime; //... @Column private DateTime makeDate;
运行时,提示如下错误
could not deserialize; nested exception is org.hibernate.type.SerializationException: could not deserialize
原因是不能被hibernate序列化。由于类型转换错误引起。
请指定转换类型。
改为如下:
@Column @DateTimeFormat(iso = ISO.DATE_TIME) @Type(type = "org.joda.time.contrib.hibernate.PersistentDateTime") private DateTime makeDate;
或者:
<property type="org.joda.time.contrib.hibernate.PersistentDateTime" name="makeDate"/>
请参见:http://joda-time.sourceforge.net/contrib/hibernate/userguide.html
切记小心谨慎。