title: INFO: Not binding factory to JNDI, no JNDI name configured org.hibernate.hql.ast.QuerySyntaxException: <TableName>is not mapped [FROM <TableName>]
body: <p>I am currently learning hibernate, unable to fetch data from oracle.. Any help on this is much appreciated.</p>
  
  <p>Please find the below configuration files, pojo class and main method...</p>
  
  <p><strong>hibernate.cfg.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!DOCTYPE hibernate-configuration SYSTEM 
  "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt;
  
  
  &lt;hibernate-configuration&gt;
      &lt;session-factory&gt;
  
          &lt;property name="hibernate.dialect"&gt;
              org.hibernate.dialect.OracleDialect
          &lt;/property&gt;
          &lt;property name="hibernate.connection.driver_class"&gt;
              oracle.jdbc.driver.OracleDriver
          &lt;/property&gt;
  
          &lt;property name="hibernate.connection.url"&gt;
              jdbc:oracle:thin:***
          &lt;/property&gt;
          &lt;property name="hibernate.connection.username"&gt;
              ***
          &lt;/property&gt;
          &lt;property name="hibernate.connection.password"&gt;
              ***
          &lt;/property&gt;
  
          &lt;mapping resource="tutorialspoint/example/Pojo_S.hbm.xml" /&gt;
  
      &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p><strong>Pojo Class</strong></p>
  
  <pre><code>package tutorialspoint.example;
  
  public class Pojo_S {
  
      int SId;
      String SCode;
      String SName; 
  
      public int getSId() {
          return SId;
      }
      public void setSId(int SId) {
          SId = SId;
      }
      public String getSCode() {
          return SCode;
      }
      public void setSCode(String SCode) {
          SCode = SCode;
      }
      public String getSName() {
          return SName;
      }
      public void setSName(String SName) {
          SName = SName;
      }
  
  }
  </code></pre>
  
  <p><strong>Pojo_S.hbm.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!DOCTYPE hibernate-mapping PUBLIC 
   "-//Hibernate/Hibernate Mapping DTD//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"&gt;
  
  
  &lt;hibernate-mapping&gt;
      &lt;class name="tutorialspoint.example.Pojo_S" table="S"&gt;
  
          &lt;id name="SId" type="int" column="S_ID"&gt;
              &lt;generator class="native" /&gt;
          &lt;/id&gt;
          &lt;property name="SCode" column="S_CODE" type="string" /&gt;
          &lt;property name="SName" column="S_NAME" type="string" /&gt;
  
      &lt;/class&gt;
  &lt;/hibernate-mapping&gt;
  </code></pre>
  
  <p><strong>Main Method</strong></p>
  
  <pre><code>package tutorialspoint.example;
  
  import java.util.Iterator;
  import java.util.List;
  
  import org.hibernate.HibernateException;
  import org.hibernate.Session;
  import org.hibernate.SessionFactory;
  import org.hibernate.Transaction;
  import org.hibernate.cfg.Configuration;
  
  public class MainApp {
  
      private static SessionFactory factory; 
      public static void main(String[] args) {
          try{
              System.out.println("In Main method of MainApp...");
  
              Configuration configure=new Configuration();  
              configure.configure("hibernate.cfg.xml");
              factory = configure.buildSessionFactory();
  
              MainApp mainApp = new MainApp();
              mainApp.listDetails_S();
          }
          catch(Throwable ex){
  
              System.err.println("Failed to create sessionFactory object." + ex);
              throw new ExceptionInInitializerError(ex); 
  
          }
      }
  
      public void listDetails_S(){
          System.out.println("In listDetails_S method of MainApp...");
  
          Session session = factory.openSession();
          Transaction tx = null;
  
          try{
  
              List details = session.createQuery("FROM S").list(); 
              for (Iterator iterator = details.iterator(); iterator.hasNext();){
                  Pojo_S detail = (Pojo_S) iterator.next(); 
                  System.out.print("\nSId: " + detail.getSId());
                  System.out.print("\nSCode: " + detail.getSCode());
                  System.out.print("\nSName: " + detail.getSName());
              }
              tx.commit();
          }
  
  
          catch (HibernateException e) {
              if (tx!=null) tx.rollback();
              e.printStackTrace(); 
          }finally {
              session.close(); 
          }
  </code></pre>
  
  <p><strong>Error Logs</strong></p>
  
  <pre><code>In Main method of MainApp...
  Mar 10, 2016 12:06:11 PM org.hibernate.cfg.Environment &lt;clinit&gt;
  INFO: Hibernate 3.2 cr4
  Mar 10, 2016 12:06:11 PM org.hibernate.cfg.Environment &lt;clinit&gt;
  INFO: hibernate.properties not found
  Mar 10, 2016 12:06:11 PM org.hibernate.cfg.Environment buildBytecodeProvider
  INFO: Bytecode provider name : cglib
  Mar 10, 2016 12:06:11 PM org.hibernate.cfg.Environment &lt;clinit&gt;
  INFO: using JDK 1.4 java.sql.Timestamp handling
  Mar 10, 2016 12:06:11 PM org.hibernate.cfg.Configuration configure
  INFO: configuring from resource: hibernate.cfg.xml
  Mar 10, 2016 12:06:11 PM org.hibernate.cfg.Configuration getConfigurationInputStream
  INFO: Configuration resource: hibernate.cfg.xml
  Mar 10, 2016 12:06:11 PM org.hibernate.cfg.Configuration addResource
  INFO: Reading mappings from resource: tutorialspoint/example/Pojo_S.hbm.xml
  Mar 10, 2016 12:06:11 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
  INFO: Mapping class: tutorialspoint.example.Pojo_S -&gt; S
  Mar 10, 2016 12:06:11 PM org.hibernate.cfg.Configuration doConfigure
  INFO: Configured SessionFactory: null
  Mar 10, 2016 12:06:12 PM org.hibernate.connection.DriverManagerConnectionProvider configure
  INFO: Using Hibernate built-in connection pool (not for production use!)
  Mar 10, 2016 12:06:12 PM org.hibernate.connection.DriverManagerConnectionProvider configure
  INFO: Hibernate connection pool size: 20
  Mar 10, 2016 12:06:12 PM org.hibernate.connection.DriverManagerConnectionProvider configure
  INFO: autocommit mode: false
  Mar 10, 2016 12:06:12 PM org.hibernate.connection.DriverManagerConnectionProvider configure
  INFO: using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:****
  Mar 10, 2016 12:06:12 PM org.hibernate.connection.DriverManagerConnectionProvider configure
  INFO: connection properties: {user=***, password=****}
  Mar 10, 2016 12:06:41 PM org.hibernate.cfg.SettingsFactory buildSettings
  INFO: RDBMS: Oracle, version: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
  With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
  Data Mining and Real Application Testing options
  Mar 10, 2016 12:06:41 PM org.hibernate.cfg.SettingsFactory buildSettings
  INFO: JDBC driver: Oracle JDBC driver, version: 11.2.0.2.0
  Mar 10, 2016 12:06:41 PM org.hibernate.dialect.Dialect &lt;init&gt;
  INFO: Using dialect: org.hibernate.dialect.OracleDialect
  Mar 10, 2016 12:06:41 PM org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
  INFO: Using default transaction strategy (direct JDBC transactions)
  Mar 10, 2016 12:06:41 PM org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
  INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
  Mar 10, 2016 12:06:41 PM org.hibernate.cfg.SettingsFactory buildSettings
  INFO: Automatic flush during beforeCompletion(): disabled
  Mar 10, 2016 12:06:41 PM org.hibernate.cfg.SettingsFactory buildSettings
  INFO: Automatic session close at end of transaction: disabled
  Mar 10, 2016 12:06:41 PM org.hibernate.cfg.SettingsFactory buildSettings
  INFO: JDBC batch size: 15
  Mar 10, 2016 12:06:41 PM org.hibernate.cfg.SettingsFactory buildSettings
  INFO: JDBC batch updates for versioned data: disabled
  Mar 10, 2016 12:06:41 PM org.hibernate.cfg.SettingsFactory buildSettings
  INFO: Scrollable result sets: enabled
  Mar 10, 2016 12:06:41 PM org.hibernate.cfg.SettingsFactory buildSettings
  INFO: JDBC3 getGeneratedKeys(): disabled
  Mar 10, 2016 12:06:41 PM org.hibernate.cfg.SettingsFactory buildSettings
  INFO: Connection release mode: auto
  Mar 10, 2016 12:06:41 PM org.hibernate.cfg.SettingsFactory buildSettings
  INFO: Default batch fetch size: 1
  Mar 10, 2016 12:06:41 PM org.hibernate.cfg.SettingsFactory buildSettings
  INFO: Generate SQL with comments: disabled
  Mar 10, 2016 12:06:41 PM org.hibernate.cfg.SettingsFactory buildSettings
  INFO: Order SQL updates by primary key: disabled
  Mar 10, 2016 12:06:41 PM org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
  INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
  Mar 10, 2016 12:06:41 PM org.hibernate.hql.ast.ASTQueryTranslatorFactory &lt;init&gt;
  INFO: Using ASTQueryTranslatorFactory
  Mar 10, 2016 12:06:41 PM org.hibernate.cfg.SettingsFactory buildSettings
  INFO: Query language substitutions: {}
  Mar 10, 2016 12:06:41 PM org.hibernate.cfg.SettingsFactory buildSettings
  INFO: JPA-QL strict compliance: disabled
  Mar 10, 2016 12:06:41 PM org.hibernate.cfg.SettingsFactory buildSettings
  INFO: Second-level cache: enabled
  Mar 10, 2016 12:06:41 PM org.hibernate.cfg.SettingsFactory buildSettings
  INFO: Query cache: disabled
  Mar 10, 2016 12:06:41 PM org.hibernate.cfg.SettingsFactory createCacheProvider
  INFO: Cache provider: org.hibernate.cache.NoCacheProvider
  Mar 10, 2016 12:06:41 PM org.hibernate.cfg.SettingsFactory buildSettings
  INFO: Optimize cache for minimal puts: disabled
  Mar 10, 2016 12:06:41 PM org.hibernate.cfg.SettingsFactory buildSettings
  INFO: Structured second-level cache entries: disabled
  Mar 10, 2016 12:06:41 PM org.hibernate.cfg.SettingsFactory buildSettings
  INFO: Statistics: disabled
  Mar 10, 2016 12:06:41 PM org.hibernate.cfg.SettingsFactory buildSettings
  INFO: Deleted entity synthetic identifier rollback: disabled
  Mar 10, 2016 12:06:41 PM org.hibernate.cfg.SettingsFactory buildSettings
  INFO: Default entity-mode: pojo
  Mar 10, 2016 12:06:41 PM org.hibernate.impl.SessionFactoryImpl &lt;init&gt;
  INFO: building session factory
  In listDetails_S method of MainApp...
  Mar 10, 2016 12:06:41 PM org.hibernate.impl.SessionFactoryObjectFactory addInstance
  INFO: Not binding factory to JNDI, no JNDI name configured
  org.hibernate.hql.ast.QuerySyntaxException: S is not mapped [FROM S]
      at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:158)
      at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:87)
      at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:70)
      at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:265)
      at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3056)
      at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2945)
      at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688)
      at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544)
      at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
      at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
      at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
      at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
      at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
      at org.hibernate.engine.query.HQLQueryPlan.&lt;init&gt;(HQLQueryPlan.java:77)
      at org.hibernate.engine.query.HQLQueryPlan.&lt;init&gt;(HQLQueryPlan.java:56)
      at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
      at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
      at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
      at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
      at tutorialspoint.example.MainApp.listDetails_S(MainApp.java:42)
      at tutorialspoint.example.MainApp.main(MainApp.java:24)
  }
  </code></pre>