Step 1, create TimestampAdapter class
import java.sql.Timestamp;
import java.util.Date;
import javax.xml.bind.annotation.adapters.XmlAdapter;
public class TimestampAdapter extends XmlAdapter<Date, Timestamp> {
public Date marshal(Timestamp v) {
return new Date(v.getTime());
}
public Timestamp unmarshal(Date v) {
return new Timestamp(
v.getTime());
}
}
Step 2, Attach the following code to every usage of the Timestamp class,such as:
@XmlJavaTypeAdapter(value=TimestampAdapter.class,type=Timestamp.class)
@Column(name = "ENDTIME", length = 7)
public Timestamp getEndtime() {
return this.endtime;
}
public void setEndtime(Timestamp endtime) {
this.endtime = endtime;
}