title: JPA CriteriaQuery class's "from" method does not accept entity class. Throws IllegalArgumentException
body: <p>I am trying to pass in a entity class into JPA CriteriaQuery class to make a MySQL search operation. But at run time i get an error saying </p>
  
  <blockquote>
    <p>"java.lang.IllegalArgumentException: Not an entity: class</p>
  </blockquote>
  
  <p><code>com.flowManagementSystem.entity.Users</code> <code>com.flowManagementSystem.entity.User</code>s is my entity class</p>
  
  <p>Class has <code>javax.persistence.Entity</code> annotation and the table name. Also, class is mapped in <code>hibernate.cfg.xml</code> file</p>
  
  <pre><code>//hibernate config&gt; 
  &lt;hibernate-configuration&gt;
      &lt;session-factory&gt;
      ...
          &lt;mapping class="com.flowManagementSystem.entity.Users" /&gt;
  &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  
  //Entity class&gt; 
  package com.flowManagementSystem.entity;
  
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  import javax.persistence.Table;
  
  
  import javax.persistence.Column;
  
  import java.util.Date;
  
  
  
  @Entity
  @Table(name = "users")
  public class Users {
  
  
  @Id
  @GeneratedValue(strategy = GenerationType.TABLE)
      @Column(name = "us_prime")
  private int usPrima;
  
  @Column(name = "us_id")
  private String usId;
  </code></pre>
  
  <p>I am expecting it to connect to MySQL DB and pull some data</p>
  
  <p>P<a href="https://i.stack.imgur.com/2F45s.png" rel="nofollow noreferrer">Project structure</a></p>