title: hibernate + spring boot store date on UTC time zone troubles
body: <p>I'm making some tests to define UTC as default time zone for my application. First of all I want my datetime values to be stored with the UTC one.</p>
  
  <p>According to VLAD MIHALCEA (<a href="https://vladmihalcea.com/how-to-store-date-time-and-timestamps-in-utc-time-zone-with-jdbc-and-hibernate/" rel="noreferrer">https://vladmihalcea.com/how-to-store-date-time-and-timestamps-in-utc-time-zone-with-jdbc-and-hibernate/</a>) and <a href="https://moelholm.com/2016/11/09/spring-boot-controlling-timezones-with-hibernate/" rel="noreferrer">https://moelholm.com/2016/11/09/spring-boot-controlling-timezones-with-hibernate/</a> I have set in my properties file:</p>
  
  <pre><code>spring.jpa.properties.hibernate.jdbc.time_zone= UTC
  </code></pre>
  
  <p>For testing I'm using h2 database, I've created a sample entity with all java 8 dateTime Type.</p>
  
  <p>In my liquibase config they are defined like this:</p>
  
  <pre><code>&lt;column name="instant" type="timestamp"/&gt;
  &lt;column name="local_date" type="date"/&gt;
  &lt;column name="local_time" type="time"/&gt;
  &lt;column name="offset_time" type="time"/&gt;
  &lt;column name="local_date_time" type="timestamp"/&gt;
  &lt;column name="offset_date_time" type="timestamp"/&gt;
  &lt;column name="zoned_date_time" type="timestamp"/&gt;
  </code></pre>
  
  <p>I think I'm using the good type for every fields. It's work for all fields except for "local_time" "offset_time" which are Time sql types not timestamp.</p>
  
  <p><a href="https://i.stack.imgur.com/eB57b.png" rel="noreferrer"><img src="https://i.stack.imgur.com/eB57b.png" alt="enter image description here"></a></p>
  
  <p>As you can see i added this row at 8:39am (Paris GMT+2) and timestamps have the good UTC value (6:38am).
  BUT both "local_time" and "offset_time" have a strange value (7:39am).</p>
  
  <p>I wonder why this behaviour, if some of you have an idea why my two time fields not store values correctly.</p>
  
  <p>PS: version:</p>
  
  <ul>
  <li>Hibernate: 5.2.17.Final</li>
  <li>Spring boot: 2.0.4.RELEASE</li>
  </ul>
  
  <p>My sample Entity use to insert data :</p>
  
  <pre><code>import javax.persistence.*;
  import java.io.Serializable;
  import java.time.*;
  import java.util.Objects;
  
  @Entity
  @Table(name = "avdev_myData")
  public class MyData implements Serializable {
  
      private static final long serialVersionUID = 1L;
  
      @Id
      @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
      @SequenceGenerator(name = "sequenceGenerator")
      private Long id;
  
      @Column(name = "name")
      private String name;
  
      @Column(name = "instant")
      private Instant instant;
  
      @Column(name = "local_date")
      private LocalDate localDate;
  
      @Column(name = "local_time")
      private LocalTime localTime;
  
      @Column(name = "offset_time")
      private OffsetTime offsetTime;
  
      @Column(name = "local_date_time")
      private LocalDateTime localDateTime;
  
      @Column(name = "offset_date_time")
      private OffsetDateTime offsetDateTime;
  
      @Column(name = "zoned_date_time")
      private ZonedDateTime zonedDateTime;
  </code></pre>