arnaudroger / SimpleFlatMapper

Fast and Easy mapping from database and csv to POJO. A java micro ORM, lightweight alternative to iBatis and Hibernate. Fast Csv Parser and Csv Mapper
http://simpleflatmapper.org
MIT License
440 stars 76 forks source link

Mapping Db2 Timestamp '0001-01-01 00:00:00.0' #728

Open clovermen opened 4 years ago

clovermen commented 4 years ago

sfm version 8.2.2

i have a simple pojo with two timestamp fields

  public class Pojo {

   private LocalDateTime firstTimestamp;
   private LocalDateTime secondTimestamp;

i want to read two timestamps from my db2 table and map these into the pojo object. The firstTimestamp is '0001-01-01 00:00:00.0' and the second like '2020-07-17 13:30:00'

RowMapper<Pojo> rowMapper = JdbcTemplateMapperFactory.newInstance().newRowMapper(Pojo.class);

List<Pojo> dwhQuittungen = this.jdbcTemplate.query("SELECT FIRST_TIMESTAMP, SECOND_TIMESTAMP FROM TABLE WITH UR", rowMapper)

The mapping of the first Timestamp is wrong. In my object is the first timestamp '0000-12-29T23:53:28' and not '0001-01-01T00:00:00.0'. The mapping of the second timestamp is correct. If I use the normal Spring BeanPropertyRowMapper is also working correctly.