title: How to resolve Hibernate Table or view does not exist?
body: <p>I am able to view a list of results from R_States table using createSQLQuery.</p>
  
  <pre><code>  public List&lt;String&gt; getStates() throws Exception {    
      try 
      {
      Session session = sessionFactory.openSession();
      return session.createSQLQuery("select * from R_States").list();
      }
      catch(Exception e)
      {
       //Logging
      }
      finally
      {
          if(session !=null &amp;&amp; session.isOpen())
          {
            session.close();
            session=null;
          }
      }
      return null;
  }
  </code></pre>
  
  <p>But when I try to use HQL createQuery method I get a ORA-00942: table or view does not exist error.  </p>
  
  <pre><code>   return session.createQuery("from States").list();
  </code></pre>
  
  <p>This is my session factory (JNDI Datasource).  </p>
  
  <pre><code>&lt;bean id="sessionFactory"
  class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
  
  &lt;property name="packagesToScan"&gt;
  &lt;list&gt;
         &lt;value&gt;folder.dao&lt;/value&gt;
         &lt;value&gt;folder.domain.States&lt;/value&gt;
     &lt;/list&gt;
  
  &lt;/property&gt;
  
  
  &lt;property name="hibernateProperties"&gt;
      &lt;props&gt;
          &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.Oracle9iDialect&lt;/prop&gt;
          &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
          &lt;prop key="hibernate.hbm2ddl.auto"&gt;update&lt;/prop&gt;
          &lt;prop key="hibernate.connection.driver_class"&gt;oracle.jdbc.OracleDriver&lt;/prop&gt;
          &lt;prop key="hibernate.connection.datasource"&gt;java:/comp/env/jdbc/r&lt;/prop&gt;
          &lt;prop key="hibernate.current_session_context_class"&gt;thread&lt;/prop&gt;
  
          &lt;/props&gt;
          &lt;/property&gt;  
      &lt;/bean&gt;
  </code></pre>
  
  <p>This is my domain class.  What am i missing?</p>
  
  <pre><code>@Entity 
  @Table(name = "R_STATE")  
  public class States {  
  
  
   @Column(name = "SCode")  
   private String stateCode;   
  
  
  @Column(name = "SName")  
   private String stateName;  
  
   public String getStateCode() {
          return stateCode;
      }
  
      public void setStateCode(String stateCode) {
          this.stateCode = stateCode;
      }
  
      public String getStateName() {
          return stateName;
      }
  
      public void setStateName(String stateName) {
          this.stateName = stateName;
      }
  </code></pre>