title: Type mismatch: number, date or string expected hibernate LocalDate
body: <p>Task:</p>
  
  <hr>
  
  <p>The field <code>dates</code> has type <code>date</code> in the <strong>database</strong>.</p>
  
  <pre class="lang-sql prettyprint-override"><code>create table items
  (
      id   serial primary key,
      dates date
  );
  </code></pre>
  
  <p><strong>Entity</strong>: // field "date" , type "LocalDate":</p>
  
  <pre class="lang-java prettyprint-override"><code>@Entity
  @Table(name = "items")
  public class Item {
      private LocalDate date;
  
      @Column(name = "dates")
      public LocalDate getDate() {
          return date;
      }
  }
  </code></pre>
  
  <p><strong>class UserStore:</strong></p>
  
  <pre class="lang-java prettyprint-override"><code>class UserStore {
      private final SessionFactory factory = new Configuration()
              .configure().buildSessionFactory();
  
      public List&lt;?&gt; findByDate() {
          Session session = factory.openSession();
          session.beginTransaction();
          final String sql = "from Item i where i.date between ?1 and ?2";
          Query query = session.createQuery(sql, Item.class);
          query.setParameter(1, LocalDate.now());
          query.setParameter(2, LocalDate.now());
          List&lt;?&gt; result = query.getResultList();
          session.getTransaction().commit();
          session.close();
          return result;
      }
  }
  </code></pre>
  
  <p><strong>pom.xml</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>        &lt;!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
              &lt;version&gt;5.4.12.Final&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-java8 --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-java8&lt;/artifactId&gt;
              &lt;version&gt;5.4.17.Final&lt;/version&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>added:</p>
  
  <pre><code> &lt;property name="dialect"&gt;org.hibernate.dialect.PostgreSQL9Dialect&lt;/property&gt;
  </code></pre>
  
  <p>in the sql request: "from Item i where <strong>i.date</strong> between ?1 and ?2",
  field <strong>i.date</strong> is highlighted in red, indicating a <strong>jpa error</strong> and requiring the use of the Date type:</p>
  
  <p><a href="https://i.stack.imgur.com/udv53.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/udv53.png" alt="to look a mistake"></a></p>
  
  <p>If i use type <code>Date</code> instead <code>LocalDate</code> mistake escape. But I need <code>LocalDate</code> type.</p>
  
  <hr>
  
  <p><strong>How to fix it?</strong></p>
  
  <blockquote>
    <p>ps. The code compiles correctly.code implementation is not important. question one: How to remove the error without turning off the inspection.</p>
  </blockquote>