My Domain object has couple of Joda-Time DateTime fields. When I’m reading database values using SimpleJdbcTemplate:
Patient patient = jdbc.queryForObject(sql, new
BeanPropertyRowMapper(Patient.class), patientId);
It just fails and surprisingly, no errors were logged. I guess it’s because of the timestamp parsing to DateTime is not working with Jdbc.
If it’s possible to inherit and override BeanPropertyRowMapper and instruct to convert all java.sql.Timestamp and java.sql.Date to DateTime, it would be great and could save a lot of extra code.
Any advice?
The correct thing to do is to subclass
BeanPropertyRowMapper, overrideinitBeanWrapper(BeanWrapper)and register a custom Property Editor: