小编jwe*_*ing的帖子

具有hibernate支持的pojo中的joda.time.DateTime

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

java hibernate jodatime

11
推荐指数
1
解决办法
2万
查看次数

标签 统计

hibernate ×1

java ×1

jodatime ×1