Org. springframework. orm. hibernate3.HibernateQueryException:

Source: Internet
Author: User

[Java]
Org. springframework. orm. hibernate3.HibernateQueryException: Book is not mapped [from Book]; nested exception is org. hibernate. hql. ast. QuerySyntaxException: Book is not mapped [from Book]
At org. springframework. orm. hibernate3.SessionFactoryUtils. convertHibernateAccessException (SessionFactoryUtils. java: 657)
At org. springframework. orm. hibernate3.HibernateAccessor. convertHibernateAccessException (HibernateAccessor. java: 412)
At org. springframework. orm. hibernate3.HibernateTemplate. doExecute (HibernateTemplate. java: 424)
At org.springframework.orm.hibernate3.HibernateTemplate.exe cuteWithNativeSession (HibernateTemplate. java: 374)
At org. springframework. orm. hibernate3.HibernateTemplate. find (HibernateTemplate. java: 921)
At org. springframework. orm. hibernate3.HibernateTemplate. find (HibernateTemplate. java: 913)
At badyflf. action. impl. HibernateProductDao. findRecommend (HibernateProductDao. java: 18)
At badyflf. test. TestMain. findRecommend (TestMain. java: 21)
At sun. reflect. NativeMethodAccessorImpl. invoke0 (Native Method)
At sun. reflect. NativeMethodAccessorImpl. invoke (NativeMethodAccessorImpl. java: 39)
At sun. reflect. DelegatingMethodAccessorImpl. invoke (DelegatingMethodAccessorImpl. java: 25)
At java. lang. reflect. Method. invoke (Method. java: 597)
At org. junit. runners. model. FrameworkMethod $1. runReflectiveCall (FrameworkMethod. java: 44)
At org. junit. internal. runners. model. ReflectiveCallable. run (ReflectiveCallable. java: 15)
At org. junit. runners. model. FrameworkMethod. invokeExplosively (FrameworkMethod. java: 41)
At org. junit. internal. runners. statements. InvokeMethod. evaluate (InvokeMethod. java: 20)
At org. junit. internal. runners. statements. RunBefores. evaluate (RunBefores. java: 28)
At org. junit. internal. runners. statements. RunAfters. evaluate (RunAfters. java: 31)
At org. junit. runners. BlockJUnit4ClassRunner. runChild (BlockJUnit4ClassRunner. java: 73)
At org. junit. runners. BlockJUnit4ClassRunner. runChild (BlockJUnit4ClassRunner. java: 46)
At org. junit. runners. ParentRunner. runChildren (ParentRunner. java: 180)
At org. junit. runners. ParentRunner. access $000 (ParentRunner. java: 41)
At org. junit. runners. ParentRunner $1. evaluate (ParentRunner. java: 173)
At org. junit. internal. runners. statements. RunBefores. evaluate (RunBefores. java: 28)
At org. junit. internal. runners. statements. RunAfters. evaluate (RunAfters. java: 31)
At org. junit. runners. ParentRunner. run (ParentRunner. java: 220)
At org. eclipse. jdt. internal. junit4.runner. JUnit4TestReference. run (JUnit4TestReference. java: 46)
At org. eclipse. jdt. internal. junit. runner. TestExecution. run (TestExecution. java: 38)
At org. eclipse. jdt. internal. junit. runner. RemoteTestRunner. runTests (RemoteTestRunner. java: 467)
At org. eclipse. jdt. internal. junit. runner. RemoteTestRunner. runTests (RemoteTestRunner. java: 683)
At org. eclipse. jdt. internal. junit. runner. RemoteTestRunner. run (RemoteTestRunner. java: 390)
At org. eclipse. jdt. internal. junit. runner. RemoteTestRunner. main (RemoteTestRunner. java: 197)
Caused by: org. hibernate. hql. ast. QuerySyntaxException: Book is not mapped [from Book]
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: 255)
At org. hibernate. hql. anlr. HqlSqlBaseWalker. fromElement (HqlSqlBaseWalker. java: 3056)
At org. hibernate. hql. anlr. HqlSqlBaseWalker. fromElementList (HqlSqlBaseWalker. java: 2945)
At org. hibernate. hql. anlr. HqlSqlBaseWalker. fromClause (HqlSqlBaseWalker. java: 688)
At org. hibernate. hql. anlr. HqlSqlBaseWalker. query (HqlSqlBaseWalker. java: 544)
At org. hibernate. hql. anlr. HqlSqlBaseWalker. selectStatement (HqlSqlBaseWalker. java: 281)
At org. hibernate. hql. anlr. 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. <init> (HQLQueryPlan. java: 77)
At org. hibernate. engine. query. HQLQueryPlan. <init> (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 org. springframework. orm. hibernate3.HibernateTemplate $30. doInHibernate (HibernateTemplate. java: 923)
At org. springframework. orm. hibernate3.HibernateTemplate. doExecute (HibernateTemplate. java: 419)
... 29 more
Cause:
Mapping not found
Solution:
1. The original idea is stuck: whether to match and inherit the correct relationship between the product and book. Check, compare, and confirm that there are no errors in the inheritance relationship configuration several times, but it is still difficult to find the Book is not mapped.
2. I don't want to go back and look for the Hibernate project. Is there anything missing? I finally found that I forgot to add <value> badyflf/action/mapping/Product. hbm. xml </value> to ssh. xml.
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.