Hibernate version: 2.1.6
In doing some profiling I noticed that I'm spending a lot of time creating SimpleDateFormat objects in TimestampType...
I found the following:
Code:
private static final String TIMESTAMP_FORMAT = "yyyy-MM-dd HH:mm:ss";
public Object fromStringValue(String xml) throws HibernateException {
try {
return new Timestamp(new SimpleDateFormat(TIMESTAMP_FORMAT).parse(xml).getTime());
}
catch (ParseException pe) {
throw new HibernateException("could not parse XML", pe);
}
}
public String toString(Object val) {
return new SimpleDateFormat(TIMESTAMP_FORMAT).format( (java.util.Date) val );
}
Why create this object on the way in and out of every Timestamp column?