首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

使用TimestampAdapter解决JAXB无法映射Timestamp类型的有关问题

2012-10-07 
使用TimestampAdapter解决JAXB无法映射Timestamp类型的问题当Jaxb中存在Timestamp类型(任何Bean中包含Time

使用TimestampAdapter解决JAXB无法映射Timestamp类型的问题
当Jaxb中存在Timestamp类型(任何Bean中包含Timestamp)的话,容器启动时会出现一个运行时错误,说Timestamp没有一个默认的构造器。解决这个问题的办法如下:

(1)写一个Timestamp Adapter:

@Column(name = "TIME_UPDATED", length = 19)@XmlJavaTypeAdapter(TimestampAdapter.class) //加入这一行public Timestamp getTimeUpdated() {return this.timeUpdated;}

热点排行