Win a copy of Secure Financial Transactions with Ansible, Terraform, and OpenSCAP this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Issue in Hibernate Mapping Entity class with DB table using Annotations

Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am building a sample spring hibernate application.Spring part is working fine.In hibernate I have mapped the bean class and the table.Still I get a error saying bean class is not mapped.Please find the attached code for reference.need your help fixing this.


Following is the stack trace

Aug 08, 2016 4:53:10 PM prepareRefresh
INFO: Refreshing startup date [Mon Aug 08 16:53:10 IST 2016]; root of context hierarchy
Aug 08, 2016 4:53:10 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [Spring.xml]
Aug 08, 2016 4:53:11 PM org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName
INFO: Loaded JDBC driver:
Aug 08, 2016 4:53:12 PM org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.3.Final}
Aug 08, 2016 4:53:12 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.3.11.Final}
Aug 08, 2016 4:53:12 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: not found
Aug 08, 2016 4:53:12 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Aug 08, 2016 4:53:12 PM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.SQLServer2008Dialect
Aug 08, 2016 4:53:12 PM org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000399: Using default transaction strategy (direct JDBC transactions)
Aug 08, 2016 4:53:12 PM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory
**Exception in thread "main" org.hibernate.hql.internal.ast.QuerySyntaxException: Circle is not mapped [from Circle]
   at org.hibernate.hql.internal.ast.QuerySyntaxException.generateQueryException(
   at org.hibernate.QueryException.wrapWithQueryString(
   at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(
   at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(
   at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(
   at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(
   at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(
   at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(
   at org.hibernate.internal.AbstractSessionImpl.createQuery(
   at org.hibernate.internal.SessionImpl.createQuery(
   at re.test.HibernateDAOImpl.getTableCount(
   at re.test.JDBCDemo.main(
Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: Circle is not mapped
   at org.hibernate.hql.internal.ast.util.SessionFactoryHelper.requireClassPersister(
   at org.hibernate.hql.internal.ast.tree.FromElementFactory.addFromElement(
   at org.hibernate.hql.internal.ast.tree.FromClause.addFromElement(
   at org.hibernate.hql.internal.ast.HqlSqlWalker.createFromElement(
   at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromElement(
   at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromElementList(
   at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromClause(
   at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(
   at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(
   at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(
   at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(
   at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(
   ... 9 more**
Posts: 11604
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why do you have your entity class Circle mapped as a spring-managed bean. That makes no sense at all!

You should have either a META-INF/persistence.xml to define your persistence unit or set the packagesToScan property of the LocalContainerEntityManagerFactoryBean to the appropriate package (containing all your entityies). See this tutorial for more information
Hug your destiny! And hug this tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
    Bookmark Topic Watch Topic
  • New Topic