title: Entity table is not mapped
body: <p>I'm new to Springboot and I'm having challenges retrieving an entry from my Entity table using JPQL statements.</p>
  
  <p>I am running a small spring web project and a call from Postman to my Java API is supposed to return a "Tour" entity. The issue is that when I use a the <code>em.find(Entity.class, PrimaryKey)</code>, I have no problems retrieving the entity but when I use a JPQL statement <code>"SELECT t FROM tour t WHERE t.employee.empName = ?1"</code> It throws an exception basically saying that the entity table is not mapped.</p>
  
  <p>Any suggestions as to how to overcome this?</p>
  
  <p>Relevant code:
  API method</p>
  
  <pre><code>@CrossOrigin
  @GetMapping(value = "/test")
  public ResponseEntity&lt;Tour&gt; testMethod(@RequestBody String name){
  
      Tour t = null;;
      try {
          t = service.getTour(name);
      } catch (Exception e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  
      return new ResponseEntity&lt;Tour&gt;(t, HttpStatus.OK);
  }
  </code></pre>
  
  <p>Service method</p>
  
  <pre><code>public Tour getTour(String name) throws Exception{
      Tour t = dao.getTour(name);
  
      if(t == null) {
          throw new Exception("Service.TOUR_NOT_FOUND");
      }
  
      return t;
  }
  </code></pre>
  
  <p>DAO method</p>
  
  <pre><code>public Tour getTour(String name) {
      String sql = "SELECT t FROM tour t WHERE t.employee.empName = ?1";
      Query q = em.createQuery(sql);
      q.setParameter(1, name);
  
      TourEntity te = (TourEntity) q.getSingleResult();
  
      Tour t = new Tour();
      Employee e = new Employee();
      ArrayList&lt;Visitor&gt; vl = new ArrayList&lt;Visitor&gt;();
  
      for(VisitorEntity ve : te.getVisitors()) {
          Visitor v = new Visitor();
          v.setVisitorId(ve.getId());
          v.setName(ve.getName());
          v.setEmail(ve.getEmail());
          v.setCompany(ve.getCompany());
          v.setFeedback(ve.getFeedback());
          v.setDesignation(ve.getDesignation());
          v.setPhoneNo(ve.getPhone());
  
          vl.add(v);
      }
  
      e.setEmpId(te.getEmployee().getEmpId());
      e.setName(te.getEmployee().getEmpName());
      e.setDesignation(te.getEmployee().getDesignation());
      if(te.getEmployee().getIsAdmin().equals("Y")) {
          e.setAdmin(true);
      }else {
          e.setAdmin(false);
      }
      e.setEmail(te.getEmployee().getEmail());
      e.setPassword(te.getEmployee().getPassword());
  
      t.setTourId(te.getId());
      t.setFeedback(te.getFeedback());    
      t.setVisitor(vl);
      t.setEmployee(e);
      t.setTourDate(te.getTourDate().toLocalDate());
  
      return t;
  }
  </code></pre>
  
  <p>Entity classes</p>
  
  <pre><code>@Entity
  @Table(name="tour")
  public class TourEntity {
      @Id
      @GeneratedValue(strategy=GenerationType.AUTO)
      private Integer id;
      private String name;
      @Column(name="tour_date")
      private Date tourDate;
      @OneToOne(cascade=CascadeType.ALL)
      @JoinColumn(name="employee_id")
      private EmployeeEntity employee;
      private String feedback;
      @OneToMany(targetEntity=VisitorEntity.class)
      @JoinColumn(name="id")
      private List&lt;VisitorEntity&gt; visitor;
  
  **Getters &amp; Setters**
  
  @Entity
  @Table(name="Employee")
  public class InfoscionEntity {
      @Id
      @Column(name="emp_id")
      @GeneratedValue(strategy=GenerationType.AUTO)
      private Integer empId;
      @Column(name="empname")
      private String empName;
      private String email;
      private String designation;
      private String password;
      @Column(name="isadmin")
      private String isAdmin;
  
  **Getters and Setters**
  </code></pre>
  
  <p>Thank you.</p>