title: Hibernate: Mapping not found exception
body: <p>Started Hibernate from its official docs. I am stuck at the most basic step of configuring the xml files. Although I have done everything as described in the examples but it fails to find the  <code>The mapping file</code>. </p>
  
  <p>This is the exception:</p>
  
  <pre><code>Exception in thread "main" org.hibernate.MappingNotFoundException: resource: testing/ground/beans/User.hbm.xml not found
      at org.hibernate.cfg.Configuration.addResource(Configuration.java:728)
      at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:2115)
      at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:2087)
      at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2067)
      at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2020)
      at org.hibernate.cfg.Configuration.configure(Configuration.java:1935)
      at org.hibernate.cfg.Configuration.configure(Configuration.java:1914)
      at testing.ground.test.HibernateTest.main(HibernateTest.java:14)
  </code></pre>
  
  <p>The code with main():</p>
  
  <pre><code>package testing.ground.test;
  
  import java.util.List;
  
  import org.hibernate.Session;
  import org.hibernate.SessionFactory;
  import org.hibernate.cfg.Configuration;
  
      public class HibernateTest {
          private SessionFactory sessionFactory;
  
          public static void main(String[] args) {
              HibernateTest ht = new HibernateTest();
              ht.sessionFactory = new Configuration().configure().buildSessionFactory();
              ht.getData();
          }
  
          public void getData(){
              Session session = this.sessionFactory.getCurrentSession();
              session.beginTransaction();
              List list = session.createQuery("from users").list();
              System.out.println(list);
              session.getTransaction().commit();
              session.close();
          }
  
  
  
      }
  </code></pre>
  
  <p>The Hibernate config file:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"&gt;
  
  &lt;hibernate-configuration&gt;
  
      &lt;session-factory&gt;
  
          &lt;!-- Database connection settings --&gt;
          &lt;property name="connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt;
          &lt;property name="connection.url"&gt;jdbc:mysql://localhost:3306/somedb?characterEncoding=UTF-8&lt;/property&gt;
          &lt;property name="connection.username"&gt;username&lt;/property&gt;
          &lt;property name="connection.password"/&gt;
  
          &lt;!-- JDBC connection pool (use the built-in) --&gt;
          &lt;property name="connection.pool_size"&gt;1&lt;/property&gt;
  
          &lt;!-- SQL dialect --&gt;
          &lt;property name="dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt;
  
          &lt;!-- Echo all executed SQL to stdout --&gt;
          &lt;property name="show_sql"&gt;true&lt;/property&gt;
  
          &lt;mapping resource="testing/ground/beans/User.hbm.xml"/&gt;
  
      &lt;/session-factory&gt;
  
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>I have tried to keep the folder structure same as that in the Hiberante examples:</p>
  
  <p><img src="https://i.stack.imgur.com/9Zhnl.jpg" alt="Screen for package structure"></p>
  
  <p>Please advice.</p>