title: Native named query fails with exception "column is of type date but expression is of type bytea"when NULL LocalDate is given as input
body: <p>Query:</p>
  
  <pre><code>    INSERT INTO PERSON 
          (email, mobile, party_id, affiliate_id, eligibility, member_start_date, created_by, created_dt, first_name, last_name, google_connected) 
          values 
          ('xxx@yyy.org', NULL, 123, '123', '1', NULL, NULL, '2018-8-30 21:45:56.859000 -6:0:0', 'xxx', 'yyy', '0')
          ON CONFLICT (email) 
          DO UPDATE SET create_dt = '2018-8-30 21:45:56.859000 -6:0:0' where email = ?
  </code></pre>
  
  <p>When the LocalDate value is not null, it works fine. Facing this issue only when LocalDate value is given as null. </p>
  
  <p>Even after PostgreSQL casting, it does the same. </p>
  
  <p>Exception stacktrace:</p>
  
  <blockquote>
    <p>2018-08-30 21:10:48,372 -- [ERROR]-- There was an unexpected problem
    with your request org.postgresql.util.PSQLException: ERROR: column
    "member_start_date" is of type date but expression is of type bytea<br>
    Hint: You will need to rewrite or cast the expression.   Position: 185
      at
    org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2182)
      at
    org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1911)
      at
    org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:173)
      at
    org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:645)
      at
    org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:495)
      at
    org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:380)     at sun.reflect.GeneratedMethodAccessor98.invoke(Unknown Source)     at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)     at
    org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:114)
      at com.sun.proxy.$Proxy185.executeQuery(Unknown Source)     at      at
    org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:70)
      ... 149 common frames omitted</p>
  </blockquote>
  
  <p>Entity:</p>
  
  <pre><code>@Entity(name = "person")
  @EqualsAndHashCode(callSuper = false)
  public class PersonEntity extends Audit {
  
  @Id
  @GeneratedValue
  @Column(name = "person_id", columnDefinition = "uuid", updatable = false)
  private UUID id;
  
  @Column(name = "first_name")
  private String firstName;
  
  @Column(name = "last_name")
  private String lastName;
  
  @Column(name = "email")
  @NotNull
  private String email;
  
  @Column(name = "mobile")
  private String mobile;
  
  @Column(name = "party_id")
  private Long partyId;
  
  @Column(name = "affiliate_id")
  private String affiliateId;
  
  @Column(name = "eligibility")
  @NotNull
  private Boolean eligibility;
  
  @Column(name = "member_start_date")
  private LocalDate memberStartDate;
  
  @Column(name = "google_connected")
  private Boolean googleAccountConnected;
  }
  </code></pre>
  
  <p>PostgreSQL table definition; it's missing <code>google_connected</code> column which is not important:</p>
  
  <pre><code>CREATE TABLE person
  ( 
     person_id             UUID NOT NULL,
     email                 VARCHAR(128) NOT NULL,
     mobile                VARCHAR(20), 
     party_id              INTEGER,
     affiliate_id          VARCHAR(20),
     eligibility              BOOLEAN NOT NULL,
     member_start_date     DATE, 
     created_by            VARCHAR(128) NOT NULL,
     created_dt            TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
     updated_by            VARCHAR(128) DEFAULT NULL,
     updated_dt            TIMESTAMP NULL,
     CONSTRAINT person_pk PRIMARY KEY ( person_id )
   );
  </code></pre>