title: Hibernate persists Java 8 DateTimeLocal as VARBINARY in SQL Server
body: <p>I'm trying to make use of the Java 8 date &amp; time API in a new application which is backed by SQL Server database. All the resources on the Internet state that Hibernate 5.2+ support this API and Java 8 out of the box and suggest a simple approach as:</p>
  
  <pre><code>@Entity
  @Table(name="...", schema="...")
  public class DepositDetails {
  
      // ... id, other fields ...
  
      private LocalDateTime createdOn;
  
      // ... other fields, getters/setters ...
  
  }
  </code></pre>
  
  <p>In my case, however, the column which is created in the database (using <a href="http://hibernate.org/orm/tooling/" rel="nofollow noreferrer" title="hibernate-jpamodelgen">hibernate-jpamodelgen</a>), is created as VARBINARY(255) instead of DATETIME/DATETIME2.<br>
  I've also tried specifying the datatype explicitly (columnDefinition = "DATETIME") - in this case the column type is created correctly as specified, but when I try to persist data in the table, I get an exception stating that varbinary data cannot be converted to datetime...</p>
  
  <p>Some more details about the application setup that may be related to the issue:</p>
  
  <ul>
  <li>Hibernate is 5.2.12.Final</li>
  <li>SQL Server is Microsoft SQL Server Developer Edition (64-bit) 14.0.900.75 (in a Docker container)</li>
  <li>MSSQL JDBC driver is 6.2.2.jre8</li>
  </ul>