Note that there are some explanatory texts on larger screens.

plurals
  1. POHibernate table not mapped error
    primarykey
    data
    text
    <p>I have a web application that use Hibernate to make CRUD operations over a database. I got an error saying that the table is not mapped. See the Java files:</p> <p>Error message:</p> <pre><code>org.springframework.orm.hibernate3.HibernateQueryException: Books is not mapped [SELECT COUNT(*) FROM Books]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: Books is not mapped [SELECT COUNT(*) FROM Books] at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:660) at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412) at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411) ... Caused by: org.hibernate.hql.ast.QuerySyntaxException: Books is not mapped [SELECT COUNT(*) FROM Books] at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:181) at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:111) at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:93) ... </code></pre> <p>Here's my <code>DAO.java</code> method:</p> <pre><code>public int getTotalBooks(){ return DataAccessUtils.intResult(hibernateTemplate.find("SELECT COUNT(*) FROM Books")); } </code></pre> <p><code>Book.java</code>:</p> <pre><code>@Entity @Table(name="Books") public class Book { @Id @GeneratedValue @Column(name="id") private int id; @Column(name="title", nullable=false) private String title; ... } </code></pre> <p>How should I modify it in order to work?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload