We're updating the issue view to help you get more done. 

OffsetDateTime value changes after fetching the row from the database

Description

I found this issue while investigating a reported bug for LocalDate on StackOverflow.

Starting from this entity:

1 2 3 4 5 6 7 8 9 10 @Entity(name = "OffsetDateTimeEvent") public static class OffsetDateTimeEvent { @Id private Long id; @NotNull @Column(name = "START_DATE", nullable = false) private OffsetDateTime startDate; }

when running this logic:

1 2 3 4 5 6 7 8 9 10 11 doInJPA(entityManager -> { OffsetDateTimeEvent event = new OffsetDateTimeEvent(); event.id = 1L; event.startDate = OffsetDateTime.of(1, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC); entityManager.persist(event); }); doInJPA(entityManager -> { OffsetDateTimeEvent event = entityManager.find(OffsetDateTimeEvent.class, 1L); assertEquals(OffsetDateTime.of(1, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC), event.startDate); });

we get this assertion failure:

java.lang.AssertionError: expected:<0001-01-01T00:00Z> but was:<0001-01-01T01:34:52+01:34:52>

Test case will be added after I know the issue number.

Environment

None

Status

Assignee

Andrea Boriero

Reporter

Vlad Mihalcea

Fix versions

Affects versions

5.0.5

Priority

Major