title: Why "org.hibernate.hql.internal.ast.QuerySyntaxException: customer is not mapped [from customer]" error is coming
body: <p>i am facing below error:
  Type Exception Report</p>
  
  <p>Message Request processing failed; nested exception is java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: customer is not mapped [from customer]</p>
  
  <p>Description The server encountered an unexpected condition that prevented it from fulfilling the request.</p>
  
  <p>Exception</p>
  
  <p>org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: customer is not mapped [from customer]</p>
  
  <p>Entity Class:</p>
  
  <pre><code>package com.luv2code.springdemo.entity;
  
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  import javax.persistence.Table;
  
  
  //@Table(schema = "web_customer_tracker", name = "customer")
  @Table(name="customer")
  @Entity
  public class Customer {
  
      @Id
      @GeneratedValue(strategy=GenerationType.IDENTITY)
      @Column(name="id")
      private int id;
  
      @Column(name="first_name")
      private String firstName;
  
      @Column(name="last_name")
      private String lastName;
  
      @Column(name="email")
      private String email;
  
      public Customer() {
  
      }
  
      public int getId() {
          return id;
      }
  
      public void setId(int id) {
          this.id = id;
      }
  
      public String getFirstName() {
          return firstName;
      }
  
      public void setFirstName(String firstName) {
          this.firstName = firstName;
      }
  
      public String getLastName() {
          return lastName;
      }
  
      public void setLastName(String lastName) {
          this.lastName = lastName;
      }
  
      public String getEmail() {
          return email;
      }
  
      public void setEmail(String email) {
          this.email = email;
      }
  
      @Override
      public String toString() {
          return "Customer [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", email=" + email + "]";
      }
  
  }
  </code></pre>
  
  <p>DAO impl:</p>
  
  <pre><code>package com.luv2code.springdemo.dao;
  
  import java.util.List;
  
  import org.hibernate.Session;
  import org.hibernate.SessionFactory;
  import org.hibernate.query.Query;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Repository;
  import org.springframework.transaction.annotation.Transactional;
  
  import com.luv2code.springdemo.entity.Customer;
  
  @Repository
  public class CustomerDAOImpl implements CustomerDAO {
  
  
      @Autowired
      private SessionFactory sessionFactory;
      @Override
      @Transactional
      public List&lt;Customer&gt; getCustomers() {
  
          //get the current hibernate session
              Session currentSession = sessionFactory.getCurrentSession();
  
  
          //List customers = new ArrayList&lt;Customer&gt;();
          //create a query
          Query&lt;Customer&gt; theQuery=currentSession.createQuery("from customer", Customer.class);
                  //currentSession.createQuery("from Customer", Customer.class);
          //execute query and get result list
          List&lt;Customer&gt; customers=theQuery.getResultList();
          // return the results
  
  
          /*  Customer cus1=new Customer();
          cus1.setEmail("a@gmail.com");
          cus1.setFirstName("Abhishek");
          cus1.setId(10);
          cus1.setLastName("Kumar");
          customers.add(cus1); */
  
          return customers;
      }
  
  }
  </code></pre>
  
  <p>XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:tx="http://www.springframework.org/schema/tx"
      xmlns:mvc="http://www.springframework.org/schema/mvc"
      xsi:schemaLocation="
          http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans.xsd
          http://www.springframework.org/schema/context
          http://www.springframework.org/schema/context/spring-context.xsd
          http://www.springframework.org/schema/mvc
          http://www.springframework.org/schema/mvc/spring-mvc.xsd
          http://www.springframework.org/schema/tx 
          http://www.springframework.org/schema/tx/spring-tx.xsd"&gt;
  
      &lt;!-- Add support for component scanning --&gt;
      &lt;context:component-scan base-package="com.luv2code.springdemo" /&gt;
  
      &lt;!-- Add support for conversion, formatting and validation support --&gt;
      &lt;mvc:annotation-driven/&gt;
  
      &lt;!-- Define Spring MVC view resolver --&gt;
      &lt;bean
          class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
          &lt;property name="prefix" value="/WEB-INF/view/" /&gt;
          &lt;property name="suffix" value=".jsp" /&gt;
      &lt;/bean&gt;
  
      &lt;!-- Step 1: Define Database DataSource / connection pool --&gt;
      &lt;bean id="myDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
            destroy-method="close"&gt;
          &lt;property name="driverClass" value="com.mysql.cj.jdbc.Driver" /&gt;
          &lt;property name="jdbcUrl" value="jdbc:mysql://localhost:3306/web_customer_tracker?useSSL=false&amp;amp;serverTimezone=UTC" /&gt;
          &lt;property name="user" value="springstudent" /&gt;
          &lt;property name="password" value="springstudent" /&gt; 
  
          &lt;!-- these are connection pool properties for C3P0 --&gt;
          &lt;property name="minPoolSize" value="5" /&gt;
          &lt;property name="maxPoolSize" value="20" /&gt;
          &lt;property name="maxIdleTime" value="30000" /&gt;
      &lt;/bean&gt;  
      &lt;!-- Step 2: Setup Hibernate session factory --&gt;
      &lt;bean id="sessionFactory"
          class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"&gt;
          &lt;property name="dataSource" ref="myDataSource" /&gt;
          &lt;property name="packagesToScan" value="com.luv2code.springdemo.entity" /&gt;
          &lt;property name="hibernateProperties"&gt;
             &lt;props&gt;
                &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/prop&gt;
                &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
             &lt;/props&gt;
          &lt;/property&gt;
     &lt;/bean&gt;    
  
      &lt;!-- Step 3: Setup Hibernate transaction manager --&gt;
      &lt;bean id="myTransactionManager"
              class="org.springframework.orm.hibernate5.HibernateTransactionManager"&gt;
          &lt;property name="sessionFactory" ref="sessionFactory"/&gt;
      &lt;/bean&gt;
  
      &lt;!-- Step 4: Enable configuration of transactional behavior based on annotations --&gt;
      &lt;tx:annotation-driven transaction-manager="myTransactionManager" /&gt;
  
  
  &lt;/beans&gt;
  </code></pre>