Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-10190

[GSS] (7.2.0) Wrong ZonedDateTime value read when attribute annotated with @Id

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • None
    • 7.0.5.GA
    • Hibernate
    • None
    • Workaround Exists
    • Hide

      Implement a custom UserType for mapping JDK8 time types potentially utilizing threeten-api.

      Show
      Implement a custom UserType for mapping JDK8 time types potentially utilizing threeten-api .
    • Hide

      Attached is a simple maven project that can be used to reproduce this issue (a pre-build artifact is already contained in the archive).

      A README.md is included guiding through the steps needed...

      The output will be:
      ~~~
      10:31:35,094 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) epoch[0]: 1509231600, instant: 2017-10-28T23:00:00Z, toString: 2017-10-29T01:00+02:00[Europe/Berlin], withZoneSameInstant: 2017-10-29T01:00+02:00[Europe/Berlin], offset: +02:00
      10:31:35,941 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) epoch[1]: 1509235200, instant: 2017-10-29T00:00:00Z, toString: 2017-10-29T02:00+02:00[Europe/Berlin], withZoneSameInstant: 2017-10-29T02:00+02:00[Europe/Berlin], offset: +02:00
      10:31:35,944 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) epoch[2]: 1509238800, instant: 2017-10-29T01:00:00Z, toString: 2017-10-29T02:00+01:00[Europe/Berlin], withZoneSameInstant: 2017-10-29T02:00+01:00[Europe/Berlin], offset: +01:00
      10:31:35,949 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) ------------------------------------------------------------------------------------------------
      10:31:35,949 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) – Now read with Id on Value –
      10:31:35,950 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) – here all ZonedDateTimes are correct...
      10:31:35,950 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) ------------------------------------------------------------------------------------------------
      10:31:36,050 INFO [org.hibernate.hql.internal.QueryTranslatorFactoryInitiator] (ServerService Thread Pool – 65) HHH000397: Using ASTQueryTranslatorFactory
      10:31:36,719 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) epoch[0]: 1509231600, instant: 2017-10-28T23:00:00Z, toString: 2017-10-29T01:00+02:00[Europe/Berlin], withZoneSameInstant: 2017-10-29T01:00+02:00[Europe/Berlin], offset: +02:00
      10:31:36,720 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) epoch[1]: 1509235200, instant: 2017-10-29T00:00:00Z, toString: 2017-10-29T02:00+02:00[Europe/Berlin], withZoneSameInstant: 2017-10-29T02:00+02:00[Europe/Berlin], offset: +02:00
      10:31:36,720 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) epoch[2]: 1509238800, instant: 2017-10-29T01:00:00Z, toString: 2017-10-29T02:00+01:00[Europe/Berlin], withZoneSameInstant: 2017-10-29T02:00+01:00[Europe/Berlin], offset: +01:00
      10:31:36,720 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) ------------------------------------------------------------------------------------------------
      10:31:36,720 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) – Now read with Id on Timestamp –
      10:31:36,721 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) – here the epoch[1] is wrong...
      10:31:36,721 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) ------------------------------------------------------------------------------------------------
      10:31:36,736 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) epoch[0]: 1509231600, instant: 2017-10-28T23:00:00Z, toString: 2017-10-29T01:00+02:00[Europe/Berlin], withZoneSameInstant: 2017-10-29T01:00+02:00[Europe/Berlin], offset: +02:00
      10:31:36,737 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) epoch[1]: 1509238800, instant: 2017-10-29T01:00:00Z, toString: 2017-10-29T02:00+01:00[Europe/Berlin], withZoneSameInstant: 2017-10-29T02:00+01:00[Europe/Berlin], offset: +01:00
      10:31:36,738 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) epoch[2]: 1509238800, instant: 2017-10-29T01:00:00Z, toString: 2017-10-29T02:00+01:00[Europe/Berlin], withZoneSameInstant: 2017-10-29T02:00+01:00[Europe/Berlin], offset: +01:00
      10:31:36,738 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) ------------------------------------------------------------------------------------------------
      ~~~

      Show
      Attached is a simple maven project that can be used to reproduce this issue (a pre-build artifact is already contained in the archive). A README.md is included guiding through the steps needed... The output will be: ~~~ 10:31:35,094 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) epoch [0] : 1509231600, instant: 2017-10-28T23:00:00Z, toString: 2017-10-29T01:00+02:00 [Europe/Berlin] , withZoneSameInstant: 2017-10-29T01:00+02:00 [Europe/Berlin] , offset: +02:00 10:31:35,941 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) epoch [1] : 1509235200, instant: 2017-10-29T00:00:00Z, toString: 2017-10-29T02:00+02:00 [Europe/Berlin] , withZoneSameInstant: 2017-10-29T02:00+02:00 [Europe/Berlin] , offset: +02:00 10:31:35,944 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) epoch [2] : 1509238800, instant: 2017-10-29T01:00:00Z, toString: 2017-10-29T02:00+01:00 [Europe/Berlin] , withZoneSameInstant: 2017-10-29T02:00+01:00 [Europe/Berlin] , offset: +01:00 10:31:35,949 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) ------------------------------------------------------------------------------------------------ 10:31:35,949 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) – Now read with Id on Value – 10:31:35,950 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) – here all ZonedDateTimes are correct... 10:31:35,950 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) ------------------------------------------------------------------------------------------------ 10:31:36,050 INFO [org.hibernate.hql.internal.QueryTranslatorFactoryInitiator] (ServerService Thread Pool – 65) HHH000397: Using ASTQueryTranslatorFactory 10:31:36,719 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) epoch [0] : 1509231600, instant: 2017-10-28T23:00:00Z, toString: 2017-10-29T01:00+02:00 [Europe/Berlin] , withZoneSameInstant: 2017-10-29T01:00+02:00 [Europe/Berlin] , offset: +02:00 10:31:36,720 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) epoch [1] : 1509235200, instant: 2017-10-29T00:00:00Z, toString: 2017-10-29T02:00+02:00 [Europe/Berlin] , withZoneSameInstant: 2017-10-29T02:00+02:00 [Europe/Berlin] , offset: +02:00 10:31:36,720 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) epoch [2] : 1509238800, instant: 2017-10-29T01:00:00Z, toString: 2017-10-29T02:00+01:00 [Europe/Berlin] , withZoneSameInstant: 2017-10-29T02:00+01:00 [Europe/Berlin] , offset: +01:00 10:31:36,720 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) ------------------------------------------------------------------------------------------------ 10:31:36,720 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) – Now read with Id on Timestamp – 10:31:36,721 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) – here the epoch [1] is wrong... 10:31:36,721 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) ------------------------------------------------------------------------------------------------ 10:31:36,736 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) epoch [0] : 1509231600, instant: 2017-10-28T23:00:00Z, toString: 2017-10-29T01:00+02:00 [Europe/Berlin] , withZoneSameInstant: 2017-10-29T01:00+02:00 [Europe/Berlin] , offset: +02:00 10:31:36,737 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) epoch [1] : 1509238800, instant: 2017-10-29T01:00:00Z, toString: 2017-10-29T02:00+01:00 [Europe/Berlin] , withZoneSameInstant: 2017-10-29T02:00+01:00 [Europe/Berlin] , offset: +01:00 10:31:36,738 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) epoch [2] : 1509238800, instant: 2017-10-29T01:00:00Z, toString: 2017-10-29T02:00+01:00 [Europe/Berlin] , withZoneSameInstant: 2017-10-29T02:00+01:00 [Europe/Berlin] , offset: +01:00 10:31:36,738 INFO [org.jboss.jbaesner.playground.jpa.TimeTestStartupBean] (ServerService Thread Pool – 65) ------------------------------------------------------------------------------------------------ ~~~

    Description

      A ZonedDateTime entity attribute annotated with @Id returns the wrong value when read from the database. When the annotation @Id is not present, the value is returned correctly.

      The special timestamp of Germanys daylight saving in October 2017 "2017-10-29T02:00:00+02:00" is returned after read as follows:

      • with @Id: 2017-10-29T02:00+01:00[Europe/Berlin] <- WRONG
      • without @Id: 2017-10-29T02:00+02:00[Europe/Berlin] <- CORRECT

      Attachments

        Issue Links

          Activity

            People

              gbadner@redhat.com Gail Badner (Inactive)
              rhn-support-jbaesner Joerg Baesner
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: