hibernate - 3.6.0.Final joda - 1.4如何在pojo中为hibernate支持直接joda.DateTime
所以可以 session.saveOrUpdate(rateCodeId);
POJO
public class RateCodeId implements java.io.Serializable {
private int roomId;
private org.joda.Time.DateTime date;
}
Run Code Online (Sandbox Code Playgroud)
的hbm.xml
<key-property name="date" type="org.joda.time.contrib.hibernate.PersistentDateTime">
<column length="10" name="date" />
</key-property>
Run Code Online (Sandbox Code Playgroud)
错误:
org.hibernate.MappingException:无法确定类型:org.joda.time.contrib.hibernate.PersistentDateTime
并且没有"type ="ERROR
java.lang.ClassCastException:org.joda.time.DateTime无法强制转换为java.util.Date