title: JAVA JPA Checking a date lies between two dates
body: <p>I am using JAVA JPA Criteria Builder to check a whether a date lies between two dates or not. I am passing the date into the function which is having a query on a table and that table have two dates columns. Now i want to check the date which i have passed lies between the two or not. </p>
  
  <pre><code> private CorpClientsCommRateD getCorpClientsCommRateD(Date date) {
      CorpClientsCommRateD commissionRate=null;
      try {
          CriteriaBuilder builder = em.getCriteriaBuilder();
          CriteriaQuery&lt;CorpClientsCommRateD&gt; query = builder.createQuery(CorpClientsCommRateD.class);
          Root&lt;CorpClientsCommRateD&gt; root = query.from(CorpClientsCommRateD.class);
  
          List&lt;Predicate&gt; conditions = new ArrayList();
          conditions.add(builder.between(date,root.get("effFromDate"),root.get("effToDate")));
  
          query.select(root)
                  .where(conditions.toArray(new Predicate[]{}));
  
          TypedQuery&lt;CorpClientsCommRateD&gt; commissionRates = em.createQuery(query);
          commissionRate=commissionRates.getSingleResult();
      }
      catch(Exception exp)
      {
          return commissionRate;
      }
      return commissionRate;
  }
  </code></pre>
  
  <p>I am getting a error that Error:(148, 35) java: no suitable method found for between(java.util.Date,javax.persistence.criteria.Path,javax.persistence.criteria.Path)</p>
  
  <p>Kindly help</p>