title: JPA Cannot Deserialize Java 8 LocalDateTime
body: <p>I'm using Spring Boot 1.5.1 and getting an exception anytime I hit my API when there is a LocalDateTime field in my Entity class.</p>
  
  <p>The MySQL dt column is TIMESTAMP</p>
  
  <p>Is JPA not able to natively deserialize LocalDateTime?</p>
  
  <p><strong>Console output when performing GET request</strong></p>
  
  <pre><code> 2017-03-02 22:00:18.797 ERROR 13736 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.orm.jpa.JpaSystemException: could not deserialize; nested exception is org.hibernate.type.SerializationException: could not deserialize] with root cause
  
      java.io.StreamCorruptedException: invalid stream header: 20323031
  </code></pre>
  
  <p><strong>Reservation.class</strong></p>
  
  <pre><code>package com.example.springboot.reservation;
  
  import java.time.LocalDateTime;
  
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.Id;
  import javax.persistence.Table;
  
  // Model class 
  
  @Entity
  @Table(name="reservation")
  public class Reservation {
  
      @Id
      private Long id;
  
      @Column
      private LocalDateTime dt;
  
  
      @Column(name="user_id")
      private Long userId;
  
      // Hibernate will convert camel case column names to snake case!!!
      // Don't use camelcase columns in DB
      @Column(name="party_size")
      private int partySize;
  
      public Reservation() {}
  
      public Reservation(Long id,  Long userId, int partySize) {
          this.id = id;
  
          this.userId = userId;
          this.partySize = partySize;
      }
  
      public Long getId() {
          return id;
      }
  
      public void setId(Long id) {
          this.id = id;
      }
  
      public LocalDateTime getDt() {
          return dt;
      }
  
      public void setDt(LocalDateTime dt) {
          this.dt = dt;
      }
  
      public Long getUserId() {
          return userId;
      }
  
      public void setUserId(Long userId) {
          this.userId = userId;
      }
  
      public int getPartySize() {
          return partySize;
      }
  
      public void setPartySize(int partySize) {
          this.partySize = partySize;
      }
  
  }
  </code></pre>
  
  <p><strong>pom.xml</strong></p>
  
  <pre><code>&lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;1.5.1.RELEASE&lt;/version&gt;
    &lt;/parent&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;mysql&lt;/groupId&gt;
              &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
    &lt;properties&gt;
      &lt;java.version&gt;1.8&lt;/java.version&gt;
    &lt;/properties&gt;
  </code></pre>