I have DateAdapter for JPA date field:
public class DateAdapter extends XmlAdapter<String, Date> {
private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd'T'HHmmss.SSS z");
@Override
public String marshal(Date v) throws Exception {
synchronized (dateFormat) {
return dateFormat.format(v);
}
}
@Override
public Date unmarshal(String v) throws Exception {
synchronized (dateFormat) {
return dateFormat.parse(v);
}
}
}
But if I try unmarshal String:
19990102T025555.000 GMT
unmarshal method returns
Sat Jan 02 05:55:55 MSK 1999
But I need return the same thing, which saved in base.