title: SQLSyntaxErrorException: ORA-00932: inconsistent datatypes: expected DATE got BINARY
body: <p>I would appreciate some help on this exception.</p>
  
  <p>I did some research on this error but I could not find a solution. I use JPA with hibernate and get this error when executing a query.</p>
  
  <p>Obviously, there's something that I don't understand about java LocalDate and oracle Date. :(</p>
  
  <p>This is the object:</p>
  
  <pre><code>@Entity
  @Table(name = "MY_TABLE")
  public class MyObject implements Serializable {
  
      private static final long serialVersionUID = 1731972128723930612L;
  
      @Id
      @OneToOne(fetch = FetchType.LAZY)
      @JoinColumn(name = "OTHER_ID", nullable = false)
      private OtherObject otherObject;
  
      @Column(name = "MY_DATE", columnDefinition="DATE", nullable = false)
     // @Convert(converter = LocalDateSQLDateConverter.class)
     // @Convert(converter = LocalDateConverter.class)
      private LocalDate date;
  </code></pre>
  
  <p>As you can see, I tried to use converters which convert LocalDate to java.util.Date or java.sql.Date and viceversa - both did unfortunately not help.</p>
  
  <p>This is the query:</p>
  
  <pre><code>public class MyDao extends BaseDao {
  
      public void save(MyObject object) {
          entityManager.persist(object);
      }
  
      public MyObject findByDate(LocalDate date) {
          TypedQuery&lt;MyObject&gt; query = entityManager.createQuery("SELECT w from MyObject w"
                  + " where w.date = :date", MyOBject.class)
                  .setParameter("date", date);
          return query.getResultList().stream().findFirst().orElse(null);
      }
  </code></pre>
  
  <p>This is the exception:</p>
  
  <blockquote>
    <p>java.sql.SQLSyntaxErrorException: ORA-00932: inconsistent datatypes:
    expected DATE got BINARY</p>
    
    <p>oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445)
      oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
      oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879)
      oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:450)
      oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)
      oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
      oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:207)
      oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:884)
      oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1167)
      oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1289)
      oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3584)
      oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3628)
      oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1493)
      org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:462)
      org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:79)
      org.hibernate.loader.Loader.getResultSet(Loader.java:2090)
      org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1887)
      org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1866)
      org.hibernate.loader.Loader.doQuery(Loader.java:905)
      org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:347)
      org.hibernate.loader.Loader.doList(Loader.java:2578)
      org.hibernate.loader.Loader.doList(Loader.java:2564)
      org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2394)
      org.hibernate.loader.Loader.list(Loader.java:2389)
      org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:495)
      org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:357)
      org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:198)
      org.hibernate.internal.SessionImpl.list(SessionImpl.java:1230)
      org.hibernate.internal.QueryImpl.list(QueryImpl.java:101)
      org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:268)
      my.company.path.MyDao.findByDate(MyDaoDao.java:21)</p>
  </blockquote>
  
  <p>Thanks a lot in advance for any hints!</p>