使用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;}