title: LocalDate in java to be persisted with JPA as date in Oracle
body: <p>I have a Policy class as below</p>
  
  <pre><code>@Entity
  </code></pre>
  
  <p>@Table(name = "Policy")
  public class Policy {</p>
  
  <pre><code>private Long policyId;
  private Long customerId;
  private Long vehicleId;
  
  @Convert(converter =LocalDateAttributeConverter.class)
  private LocalDate policyStartDate;
  
  @Convert(converter =LocalDateAttributeConverter.class)
  private LocalDate policyEndDate;
  
  @Id
  @SequenceGenerator(name = "POLICYID_GEN", sequenceName = "policyId_seq", allocationSize = 1)
  @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "POLICYID_GEN")
  @Column(name = "PolicyId")
  public Long getPolicyId() {
      return policyId;
  }
  
  public void setPolicyId(Long policyId) {
      this.policyId = policyId;
  }
  
  @Column(name = "CustomerId")
  public Long getCustomerId() {
      return customerId;
  }
  
  public void setCustomerId(Long customerId) {
      this.customerId = customerId;
  }
  
  @Column(name = "VehicleId")
  public Long getVehicleId() {
      return vehicleId;
  }
  
  public void setVehicleId(Long vehicleId) {
      this.vehicleId = vehicleId;
  }
  
  @Column(name = "PolicyStartDate")
  public LocalDate getPolicyStartDate() {
      return policyStartDate;
  }
  
  public void setPolicyStartDate(LocalDate policyStartDate) {
      this.policyStartDate = policyStartDate;
  }
  
  @Column(name = "PolicyEndDate")
  public LocalDate getPolicyEndDate() {
      return policyEndDate;
  }
  
  public void setPolicyEndDate(LocalDate policyEndDate) {
      this.policyEndDate = policyEndDate;
  }
  </code></pre>
  
  <p>I am trying to persist the same using JPA but getting below error</p>
  
  <blockquote>
    <p>Hibernate: select policyId_seq.nextval from dual Policy
    [policyId=1006, customerId=1, vehicleId=1, policyStartDate=2019-01-01,
    policyEndDate=2019-12-31] Hibernate: insert into Policy (CustomerId,
    PolicyEndDate, PolicyStartDate, VehicleId, PolicyId) values (?, ?, ?,
    ?, ?) Dec 27, 2018 2:25:25 PM
    org.apache.catalina.core.StandardWrapperValve invoke SEVERE:
    Servlet.service() for servlet [PolicyController] in context with path
    [/InsurancePortal] threw exception [Request processing failed; nested
    exception is
    org.springframework.dao.InvalidDataAccessResourceUsageException:
    ORA-00932: inconsistent datatypes: expected NUMBER got BINARY ; SQL
    [n/a]; nested exception is
    org.hibernate.exception.SQLGrammarException: ORA-00932: inconsistent
    datatypes: expected NUMBER got BINARY ] with root cause
    java.sql.SQLSyntaxErrorException: ORA-00932: inconsistent datatypes:
    expected NUMBER got BINARY</p>
  </blockquote>