title: how to get a list from table based on a single date using hibernate query language
body: <p>*I have a table named ordertab from (Order entity) with 5 columns and i have to get a list of rows based on the date i pass in showAllOrders(LocalDate date).</p>
  <p>Here is the entity class. I am using junit5 to test this. I am new to both hibernate,junit and postgres.</p>
  <pre><code>@Entity
  @Table(name = &quot;ordertab&quot;)
  public class Order {
      @Id
      private int orderId;
  
      private LocalDate orderDate;
      private LocalDate dispatchDate;
      private float totalCost;
      private String status;
      public Order() {
      };
      public Order(int orderId,LocalDate orderDate,LocalDate dispatchDate,float totalCost,String status) {
          super();
          this.orderId=orderId;
          this.orderDate=orderDate;
          this.dispatchDate=dispatchDate;
          this.totalCost=totalCost;
          this.status=status;
      }
  
      public int getOrderId() {
          return orderId;
      }
      public void setOrderId(int orderId) {
          this.orderId = orderId;
      }
      public LocalDate getOrderDate() {
          return orderDate;
      }
      public void setOrderDate(LocalDate orderDate) {
          this.orderDate = orderDate;
      }
  
      public LocalDate getDispatchDate() {
          return dispatchDate;
      }
          public void setDispatchDate(LocalDate dispatchDate) {
              this.dispatchDate = dispatchDate;
          }
          public float getTotalCost() {
              return totalCost;
          }
          public void setTotalCost(float totalCost) {
              this.totalCost = totalCost;
          }
      
          public String getStatus() {
              return status;
          }
  </code></pre>
  
  <pre><code>orderid | dispatchdate | orderdate  | status | totalcost
  ---------+--------------+------------+--------+-----------
         9 | 2020-01-08   | 2020-01-08 | pass   |         0
         8 | 2018-01-08   | 2018-01-08 | pass   |       100
  
     
  </code></pre>
  
  <pre><code> @Override
      public List&lt;Order&gt; showAllOrders(LocalDate date) {
  
          EntityManagerFactory emf =  Persistence.createEntityManagerFactory(&quot;JPA-PU&quot;);
          EntityManager em= emf.createEntityManager();
          em.getTransaction().begin();
      
           Query query = em.createQuery(&quot;from Order ord where ord.orderdate=:date&quot;);
  
           List&lt;Order&gt; orders= query.getResultList();
          em.getTransaction().commit();
          em.close();
          emf.close();
          return orders;
      }
  </code></pre>
  <p>also tried &quot;from Order where date=:date&quot; and tried after changing orderdate to orderDate as my entity class the property is spelled as orderDate then it gives</p>
  <blockquote>
  <p>org.hibernate.QueryException:Named parameter not bound : date</p>
  </blockquote>
  <p>I don't know what Iam doing wrong here.</p>
  <p>This is the failure trace:</p>
  <pre class="lang-none prettyprint-override"><code>java.lang.IllegalArgumentException: org.hibernate.QueryException: could not resolve property: orderdate of: com.cg.oam.entities.Order [from com.cg.oam.entities.Order ord where ord.orderdate=:date]
      at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:138)
      at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181)
      at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:188)
      at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:734)
      at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:23)
      at com.cg.oam.repository.OrderRepositoryImplementation.showAllOrders(OrderRepositoryImplementation.java:96)
      at com.cg.oam.service.OrderServiceImplementation.showAllOrders(OrderServiceImplementation.java:77)
      at com.cg.oam.test.service.OrderTest.testShowAllOrderByDate(OrderTest.java:90)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:564)
      at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:688)
      at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
      at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
      at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
      at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
      at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
      at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
      at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
      at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
      at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
      at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
      at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
      at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
      at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
      at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:210)
      at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
      at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:206)
      at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:131)
      at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:65)
      at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
      at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
      at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
      at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
      at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
      at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
      at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
      at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
      at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
      at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
      at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
      at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
      at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
      at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
      at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
      at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
      at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
      at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
      at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
      at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
      at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
      at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
      at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
      at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
      at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
      at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
      at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
      at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
      at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
      at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
      at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
      at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:108)
      at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
      at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
      at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
      at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
      at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:96)
      at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:84)
      at org.eclipse.jdt.internal.junit5.runner.JUnit5TestReference.run(JUnit5TestReference.java:98)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:768)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
  Caused by: org.hibernate.QueryException: could not resolve property: orderdate of: com.cg.oam.entities.Order [from com.cg.oam.entities.Order ord where ord.orderdate=:date]
      at org.hibernate.QueryException.generateQueryException(QueryException.java:120)
      at org.hibernate.QueryException.wrapWithQueryString(QueryException.java:103)
      at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:220)
      at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:144)
      at org.hibernate.engine.query.spi.HQLQueryPlan.&lt;init&gt;(HQLQueryPlan.java:113)
      at org.hibernate.engine.query.spi.HQLQueryPlan.&lt;init&gt;(HQLQueryPlan.java:73)
      at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:162)
      at org.hibernate.internal.AbstractSharedSessionContract.getQueryPlan(AbstractSharedSessionContract.java:613)
      at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:725)
      ... 71 more
  Caused by: org.hibernate.QueryException: could not resolve property: orderdate of: com.cg.oam.entities.Order
      at org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:77)
      at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:71)
      at org.hibernate.persister.entity.AbstractEntityPersister.toType(AbstractEntityPersister.java:2038)
      at org.hibernate.hql.internal.ast.tree.FromElementType.getPropertyType(FromElementType.java:412)
      at org.hibernate.hql.internal.ast.tree.FromElement.getPropertyType(FromElement.java:520)
      at org.hibernate.hql.internal.ast.tree.DotNode.getDataType(DotNode.java:695)
      at org.hibernate.hql.internal.ast.tree.DotNode.prepareLhs(DotNode.java:269)
      at org.hibernate.hql.internal.ast.tree.DotNode.resolve(DotNode.java:209)
      at org.hibernate.hql.internal.ast.HqlSqlWalker.resolve(HqlSqlWalker.java:1055)
      at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1308)
      at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4778)
      at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:4244)
      at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:2166)
      at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:832)
      at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:626)
      at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:330)
      at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:278)
      at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:276)
      at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:192)
      ... 77 more
  </code></pre>