when using The SSH Framework development process uses The tool class provided by the hibernate framework to interact with database data, and when performing a cmd operation, the following exception occurs:
Org.hibernate.hql.ast.QuerySyntaxException:xxx isn't mapped [from XXX] or
Nested exception is org.hibernate.hql.internal.ast.QuerySyntaxException
Detailed exception information
+: ,: to,951ERROR Defaultdispatchererrorhandler: the-Exception occurred during processing Request:customer isNot mapped [ fromCustomer]; Nested exception isOrg.hibernate.hql.Internal. ast. Querysyntaxexception:customer isNot mapped [ fromCustomer]org.springframework.orm.hibernate5.hibernatequeryexception:customer isNot mapped [ fromCustomer]; Nested exception isOrg.hibernate.hql.Internal. ast. Querysyntaxexception:customer isNot mapped [ fromCustomer] at Org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException ( Sessionfactoryutils.java:176) at Org.springframework.orm.hibernate5.HibernateTemplate.doExecute (Hibernatetemplate.java:344) at Org.springframework.orm.hibernate5.HibernateTemplate.executeWithNativeSession (Hibernatetemplate.java: 309) at Org.springframework.orm.hibernate5.HibernateTemplate.find (Hibernatetemplate.java:863) at Cn.itheima.ssh_exem.dao.impl.CustomerDaoImpl.findAllCustomer (Customerdaoimpl.java: -) at Cn.itheima.ssh_exem.service.impl.CustomerServiceImpl.findAllCustomer (Customerserviceimpl.java: A) at Cn.itheima.ssh_exem.action.CustomerAction.findCustomer (Customeraction.java: -) at Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at Sun.reflect.NativeMethodAccessorImpl.invoke (Nativemethodaccessorimpl.java: $) at Sun.reflect.DelegatingMethodAccessorImpl.invoke (Delegatingmethodaccessorimpl.java: +) at Java.lang.reflect.Method.invoke (Method.java:606) at OGNL. Ognlruntime.invokemethod (Ognlruntime.java:870) at OGNL. Ognlruntime.callappropriatemethod (Ognlruntime.java:1293) at OGNL. Objectmethodaccessor.callmethod (Objectmethodaccessor.java: the) at Com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethodWithDebugInfo ( Xworkmethodaccessor.java:117) at Com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethod (Xworkmethodaccessor.java:108) at OGNL. Ognlruntime.callmethod (Ognlruntime.java:1369) at OGNL. Astmethod.getvaluebody (Astmethod.java: -) at OGNL. Simplenode.evaluategetvaluebody (Simplenode.java:212) at OGNL. Simplenode.getvalue (Simplenode.java:258) at OGNL. Ognl.getvalue (Ognl.java:494) at OGNL. Ognl.getvalue (Ognl.java:458) at com.opensymphony.xwork2.ognl.ognlutil$2. Execute (Ognlutil.java:309) at Com.opensymphony.xwork2.ognl.OgnlUtil.compileAndExecute (Ognlutil.java:340) at Com.opensymphony.xwork2.ognl.OgnlUtil.getValue (Ognlutil.java:307) at Com.opensymphony.xwork2.DefaultActionInvocation.invokeAction (Defaultactioninvocation.java:423) at Com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly (Defaultactioninvocation.java:287) at Com.opensymphony.xwork2.DefaultActionInvocation.invoke (Defaultactioninvocation.java: -) at Org.apache.struts2.interceptor.DeprecationInterceptor.intercept (Deprecationinterceptor.java: A) at Com.opensymphony.xwork2.DefaultActionInvocation.invoke (Defaultactioninvocation.java:244) at Org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept (Debugginginterceptor.java: the) at Com.opensymphony.xwork2.DefaultActionInvocation.invoke (Defaultactioninvocation.java:244) at Com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept ( Defaultworkflowinterceptor.java:167) at Com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (Methodfilterinterceptor.java: 98) at Com.opensymphony.xwork2.DefaultActionInvocation.invoke (Defaultactioninvocation.java:244) at Com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept (Validationinterceptor.java:265) at Org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept ( Annotationvalidationinterceptor.java: the) at Com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (Methodfilterinterceptor.java: 98) at Com.opensymphony.xwork2.DefaultActionInvocation.invoke (Defaultactioninvocation.java:244) at Com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept ( Conversionerrorinterceptor.java:138) at Com.opensymphony.xwork2.DefaultActionInvocation.invoke (Defaultactioninvocation.java:244) at Com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept (Parametersinterceptor.java:229) at Com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (Methodfilterinterceptor.java: 98) at Com.opensymphony.xwork2.DefaultActionInvocation.invoke (Defaultactioninvocation.java:244) at Com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept (Parametersinterceptor.java:229) at Com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (Methodfilterinterceptor.java: 98) at Com.opensymphony.xwork2.DefaultActionInvocation.invoke (Defaultactioninvocation.java:244) at Com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept ( Staticparametersinterceptor.java:191) at Com.opensymphony.xwork2.DefaultActionInvocation.invoke (Defaultactioninvocation.java:244) at Org.apache.struts2.interceptor.MultiselectInterceptor.intercept (Multiselectinterceptor.java: the) at Com.opensymphony.xwork2.DefaultActionInvocation.invoke (Defaultactioninvocation.java:244) at Org.apache.struts2.interceptor.DateTextFieldInterceptor.intercept (Datetextfieldinterceptor.java: the) at Com.opensymphony.xwork2.DefaultActionInvocation.invoke (Defaultactioninvocation.java:244) at Org.apache.struts2.interceptor.CheckboxInterceptor.intercept (Checkboxinterceptor.java: the) at Com.opensymphony.xwork2.DefaultActionInvocation.invoke (Defaultactioninvocation.java:244) at Org.apache.struts2.interceptor.FileUploadInterceptor.intercept (Fileuploadinterceptor.java:253) at Com.opensymphony.xwork2.DefaultActionInvocation.invoke (Defaultactioninvocation.java:244) at Com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept (Modeldriveninterceptor.java: -) at Com.opensymphony.xwork2.DefaultActionInvocation.invoke (Defaultactioninvocation.java:244) at Com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept ( Scopedmodeldriveninterceptor.java:141) at Com.opensymphony.xwork2.DefaultActionInvocation.invoke (Defaultactioninvocation.java:244) at Com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept (Chaininginterceptor.java:145) at Com.opensymphony.xwork2.DefaultActionInvocation.invoke (Defaultactioninvocation.java:244) at Com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept (Prepareinterceptor.java:171) at Com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (Methodfilterinterceptor.java: 98) at Com.opensymphony.xwork2.DefaultActionInvocation.invoke (Defaultactioninvocation.java:244) at Com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept (I18ninterceptor.java:139) at Com.opensymphony.xwork2.DefaultActionInvocation.invoke (Defaultactioninvocation.java:244) at Org.apache.struts2.interceptor.ServletConfigInterceptor.intercept (Servletconfiginterceptor.java:164) at Com.opensymphony.xwork2.DefaultActionInvocation.invoke (Defaultactioninvocation.java:244) at Com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept (Aliasinterceptor.java:193) at Com.opensymphony.xwork2.DefaultActionInvocation.invoke (Defaultactioninvocation.java:244) at Com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept ( Exceptionmappinginterceptor.java:189) at Com.opensymphony.xwork2.DefaultActionInvocation.invoke (Defaultactioninvocation.java:244) at Org.apache.struts2.impl.StrutsActionProxy.execute (Strutsactionproxy.java: Wu) at Org.apache.struts2.dispatcher.Dispatcher.serviceAction (Dispatcher.java:564) at Org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction (Executeoperations.java:Bayi) at Org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter ( Strutsprepareandexecutefilter.java: About) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:241) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:208) at Org.springframework.orm.hibernate5.support.OpenSessionInViewFilter.doFilterInternal ( Opensessioninviewfilter.java:151) at Org.springframework.web.filter.OncePerRequestFilter.doFilter (Onceperrequestfilter.java:107) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:241) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:208) at Org.apache.catalina.core.StandardWrapperValve.invoke (Standardwrappervalve.java: -) at Org.apache.catalina.core.StandardContextValve.invoke (Standardcontextvalve.java:122) at Org.apache.catalina.authenticator.AuthenticatorBase.invoke (Authenticatorbase.java:505) at Org.apache.catalina.core.StandardHostValve.invoke (Standardhostvalve.java:169) at Org.apache.catalina.valves.ErrorReportValve.invoke (Errorreportvalve.java:103) at Org.apache.catalina.valves.AccessLogValve.invoke (Accesslogvalve.java:956) at Org.apache.catalina.core.StandardEngineValve.invoke (Standardenginevalve.java: the) at Org.apache.catalina.connector.CoyoteAdapter.service (Coyoteadapter.java:436) at Org.apache.coyote.http11.AbstractHttp11Processor.process (Abstracthttp11processor.java:1078) at Org.apache.coyote.abstractprotocol$abstractconnectionhandler.process (Abstractprotocol.java:625) at Org.apache.tomcat.util.net.jioendpoint$socketprocessor.run (Jioendpoint.java:318) at Java.util.concurrent.ThreadPoolExecutor.runWorker (Threadpoolexecutor.java:1145) at Java.util.concurrent.threadpoolexecutor$worker.run (Threadpoolexecutor.java:615) at Org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run (Taskthread.java: A) at Java.lang.Thread.run (Thread.java:745)
Problem Analysis and resolution:
The above exceptions are thrown mainly in several ways:
1. If you are using an XML configuration file development method, check that the hibernate Core configuration file declares the mapping file for the entity class. Simply put, use the name of the <mapping resource="/ Project full path name / Map entity class . hbm.xml" > Establishes a mapping relationship between an entity class and a table.
2, check hql statement written book is correct. The From is followed by the entity class name instead of the name of the data table, with attention to capitalization and word spelling errors, and the inability to include more than one space.
3, if the above two steps of detection, the execution of the results are still reported above the error message, then in your HQL statement from behind directly with the full name of the entity class .
mapping exceptions for entity classes and data tables (XXX is not mapping[])