title: Hibernate exception : table is not mapped
body: <p>I'm trying to connect to Postgres with hibernate however I'm getting exception that table is not mapped. Here is code:</p>
  
  <p>hibernate.cfg.xml</p>
  
  <pre><code>    &lt;!DOCTYPE hibernate-configuration SYSTEM
      "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"&gt;
  &lt;hibernate-configuration&gt;
  &lt;session-factory&gt;
      &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.PostgreSQL94Dialect&lt;/property&gt;
      &lt;property name="hibernate.connection.driver_class"&gt;org.postgresql.Driver&lt;/property&gt;
      &lt;property name="hibernate.connection.username"&gt;username&lt;/property&gt;
      &lt;property name="hibernate.connection.password"&gt;passwrd&lt;/property&gt;
      &lt;property name="hibernate.connection.url"&gt;jdbc:postgresql://localhost:5432/dbname&lt;/property&gt;
      &lt;property name="hibernate.hbm2ddl.auto"&gt;create&lt;/property&gt;
      &lt;property name="connection.pool_size"&gt;1&lt;/property&gt;
      &lt;property name="show_sql"&gt;true&lt;/property&gt;
      &lt;mapping class="backend.hibernate.models.UsersEntity"/&gt;
  &lt;/session-factory&gt;
  </code></pre>
  
  <p></p>
  
  <p>UsersEntity:</p>
  
  <pre><code>@Entity
  @Table(name = "Users")
  @Getter
  @Setter
  public class UsersEntity {
  @Id
  @Column(name = "id")
  @GeneratedValue
  private int id;
  @Column(name = "login")
  private String login;
  @Column(name = "password")
  private String password;
  @Column(name = "email")
  private String email;
  
  }
  </code></pre>
  
  <p>pom:</p>
  
  <pre><code>&lt;properties&gt;
      &lt;hibernate.version&gt;5.0.3.Final&lt;/hibernate.version&gt;
      &lt;postgresql.version&gt;9.4-1200-jdbc4&lt;/postgresql.version&gt;
  &lt;/properties&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
          &lt;version&gt;${hibernate.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- The tutorials use the PostgreSQL 9.3.5 database --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.postgresql&lt;/groupId&gt;
          &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
          &lt;version&gt;${postgresql.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;version&gt;3.8.1&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>error:</p>
  
  <pre><code> Exception in thread "main" org.hibernate.hql.internal.ast.QuerySyntaxException: UsersModel is not mapped [select login from UsersModel]
  at org.hibernate.hql.internal.ast.QuerySyntaxException.generateQueryException(QuerySyntaxException.java:79)
  at org.hibernate.QueryException.wrapWithQueryString(QueryException.java:103)
  at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:218)
  at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:142)
  at org.hibernate.engine.query.spi.HQLQueryPlan.&lt;init&gt;(HQLQueryPlan.java:115)
  at org.hibernate.engine.query.spi.HQLQueryPlan.&lt;init&gt;(HQLQueryPlan.java:76)
  at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:150)
  at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:298)
  at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236)
  at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1836)
  at Fronted.Main.main(Main.java:23)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:497)
  at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
   Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: UsersModel is not mapped
  at org.hibernate.hql.internal.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:171)
  at org.hibernate.hql.internal.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:91)
  at org.hibernate.hql.internal.ast.tree.FromClause.addFromElement(FromClause.java:76)
  at org.hibernate.hql.internal.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:321)
  at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3678)
  at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3567)
  at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:708)
  at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:564)
  at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:301)
  at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:249)
  at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:262)
  at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:190)
  ... 13 more
  </code></pre>
  
  <p>main:</p>
  
  <pre><code>  public class Main {
  public static void main(String[] args) {
      Configuration configuration = new Configuration().configure();
      StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder().applySettings(configuration
              .getProperties());
      SessionFactory sessionFactory = configuration.buildSessionFactory(builder.build());
      Session session = sessionFactory.openSession();
      session.beginTransaction();
      List&lt;UsersModel&gt; list = session.createQuery("from UsersEntity").list();
      session.close();
      System.out.println(list);
  }
  }
  </code></pre>
  
  <p>In my database I have table called "Users" with columns like in the UsersEntity annotations. I think, that mapping is done properly however I still get the same error. Thanks for the help</p>