ObjectDB ObjectDB

Wrong data stored in date only fileds

#1

Hi,

we have an object with the following fields:

 

    private Date startDateTime;   // Time stamp: start of recording in local time zone
    private Date startDate;         // Date: date part of startDateTime
    private Date startTime;         // Time: time part of startDateTime

    @Basic(optional = false)
    @Temporal(TemporalType.TIMESTAMP)
    public Date getStartDateTime() {
        return startDateTime;
    }

    public void setStartDateTime(Date startDateTime) {
        this.startDateTime = startDateTime;
    }

    @Basic(optional = false)
    @Temporal(TemporalType.DATE)
    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    @Basic(optional = false)
    @Temporal(TemporalType.TIME)
    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

 

When adding records to the DB close to time when a clock change is expected, for example 2am on the 25/10/2015 Madrid time (when clock goes back 1 hour at 3am), Object DB puts wrong data in the fields annotated with Temporal.DATE.

The attached DB shows the problem and can easily be reproduced.

Here are the values used to set the fields before adding the objects (in the attached DB) to the DB:

 

Record 1:

    startDateTime = Sun Oct 25 02:00:25 CEST 2015

    startDate = Sun Oct 25 00:00:00 CEST 2015

    startTime = Thu Jan 01 02:00:25 CET 1970

Record 2:

    startDateTime = Sun Oct 25 02:00:34 CEST 2015

    startDate = Sun Oct 25 00:00:00 CEST 2015

    startTime = Thu Jan 01 02:00:34 CET 1970

Record 3:

    startDateTime = Sun Oct 25 02:00:44 CEST 2015

    startDate = Sun Oct 25 00:00:00 CEST 2015

    startTime = Thu Jan 01 02:00:44 CET 1970

Record 4:

    startDateTime = Sun Oct 25 02:00:54 CEST 2015

    startDate = Sun Oct 25 00:00:00 CEST 2015

    startTime = Thu Jan 01 02:00:54 CET 1970

Record 5:

    startDateTime = Sun Oct 25 02:01:04 CEST 2015

    startDate = Sun Oct 25 00:00:00 CEST 2015

    startTime = Thu Jan 01 02:01:04 CET 1970

 

In the DB you will notice that the startDate field is set to "Sat Oct 24 00:00:00 CEST 2015", i.e. one day before 25th. The other two fields are correct.

 

This does not happen on other days. For example if add objects with the same time but on the 26th of October, the startDate is set to the 26th.

 

We would be grateful if you provide an explanation of what is going on.

 

Thank you

Emil

 

 

edit
delete
#2

It seems to be a regression of version 2.5.5 (following fixing another clock change issue).

Please try build 2.6.4_03 which should work well. Thank you for this report.

ObjectDB Support
edit
delete
#3

Hi,

2.6.4_03 appears to fix the problem (more testing pending), however there are duplicate fields in the DB. For example we now have startDate and startDate_odbHidden. All fields have an _odbHidden partner.

Is this a debug code leftover?

Thank you

Emil

edit
delete
#4

Enhanced classes have __odbHidden methods added by the Enhancer. There is a change in this build, following this forum thread, but it should not generate new fields or properties.

You may however need to rebuild your project for this new build. If this doesn't help please provide more information about this new issue.

ObjectDB Support
edit
delete
#5

Thank you.

A fresh build with 2.6.4_03 enhancer does not show the _odbHidden fields.

Emil

edit
delete

Reply

To post on this website please sign in.