jdbc and datetime changes hour 00 for 01
Posted in 2010
Hi! Have any of you faced a problem with storing times when the hour is cero? Im storing data asociated to a timestamp. I use netbeans 6.8, glassfish V2, JPA, toplink, jdbc 3.5 drivers from IBM informix and an Informix 11.50 database. The Entity has a temporal field @Basic(optional = false) @Column(name = "hora") @Temporal(TemporalType.TIME) private Date hora; It works ok for all the times but, when hora='00:15:00', for instance, it is stored '01:15:00' on the database table. An example of my test: fechaHora.setTime(sdfFechaHora.parse("2010-05-10 00:11:13")); HistPK hpk = new HistPK(); hpk.setEquipo("AAAAAAAA"); hpk.setFecha(fechaHora.getTime()); hpk.setHora(fechaHora.getTime()); h.setHistPK(hpk); histFacade.edit(h); // which is a em.merge(h) System.out.println("recupero: "+h.getHistPK()); displays recupero: persistencia.HistPK[equipo=AAAAAAAA, fecha=Mon May 10 00:11:13 MST 2010, hora=Mon May 10 00:11:13 MST 2010] but in the database table es stored AAAAAAAA 2010-05-10 01:11:13 ... for any cause, it converts the hour 00: to 01: Column hora is a datetime hour to second, fecha is datetime year to day. Im using two fields instead of just one datetime year to second for heritage reasons. I have done a variety of tests, I have change toplink for eclipse link, but the result is the same. Do you have some advice? Thanks in advance. Best regards. --Néstor