以前没有用过hibernate,配置hql时出错。
错误日志如下:
org.springframework.orm.hibernate3.HibernateQueryException: crm_person is not mapped [select a.id, (select z.corp.shortName from cn.digitalpublishing.po.CrmCorpTypeRelationship z where z.id = a.department), a.code, a.contractType, a.name, a.createOn, (select z.name from crm_person z where z.id = (SELECT x.person.id from cn.digitalpublishing.po.CrmPersonTypeRelationship x where x.id = a.createBy)), a.dateBegin, a.dateEnd, a.otherInfo, a.remark, a.approveStatus from cn.digitalpublishing.po.CrRightQt a]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: crm_person is not mapped [select a.id, (select z.corp.shortName from cn.digitalpublishing.po.CrmCorpTypeRelationship z where z.id = a.department), a.code, a.contractType, a.name, a.createOn, (select z.name from crm_person z where z.id = (SELECT x.person.id from cn.digitalpublishing.po.CrmPersonTypeRelationship x where x.id = a.createBy)), a.dateBegin, a.dateEnd, a.otherInfo, a.remark, a.approveStatus from cn.digitalpublishing.po.CrRightQt a] at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:656) at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412) at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411) at org.springframework.orm.hibernate3.HibernateTemplate.executeFind(HibernateTemplate.java:343) at cn.com.daxtech.framework.orm.hibernate3.dao.impl.HibernateDAOImpl.getListByHql(HibernateDAOImpl.java:288) at cn.digitalpublishing.dao.CrRightQtDao.getPagingList(CrRightQtDao.java:15) at cn.digitalpublishing.service.impl.CrRightQtServiceImpl.getPagingList(CrRightQtServiceImpl.java:79) at sun.reflect.GeneratedMethodAccessor459.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at com.sun.proxy.$Proxy415.getPagingList(Unknown Source) at cn.digitalpublishing.springmvc.controller.rightLicense.CrRightQtController.manager(CrRightQtController.java:85) at sun.reflect.GeneratedMethodAccessor457.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at cn.digitalpublishing.filter.LanguageFilter.doFilter(LanguageFilter.java:30) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at cn.com.daxtech.framework.web.filter.sso.PermissionFilter.doFilter(PermissionFilter.java:162) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: org.hibernate.hql.ast.QuerySyntaxException: crm_person is not mapped [select a.id, (select z.corp.shortName from cn.digitalpublishing.po.CrmCorpTypeRelationship z where z.id = a.department), a.code, a.contractType, a.name, a.createOn, (select z.name from crm_person z where z.id = (SELECT x.person.id from cn.digitalpublishing.po.CrmPersonTypeRelationship x where x.id = a.createBy)), a.dateBegin, a.dateEnd, a.otherInfo, a.remark, a.approveStatus from cn.digitalpublishing.po.CrRightQt a] at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:180) at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:111) at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:93) at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:327) at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3441) at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3325) at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:733) at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:584) at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExpr(HqlSqlBaseWalker.java:2321) at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExprList(HqlSqlBaseWalker.java:2121) at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectClause(HqlSqlBaseWalker.java:1522) at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:593) at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:301) at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:244) at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:256) at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:187) at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:138) at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101) at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80) at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124) at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156) at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135) at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1770) at sun.reflect.GeneratedMethodAccessor285.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.orm.hibernate3.HibernateTemplate$CloseSuppressingInvocationHandler.invoke(HibernateTemplate.java:1282) at com.sun.proxy.$Proxy7.createQuery(Unknown Source) at cn.com.daxtech.framework.orm.hibernate3.dao.impl.HibernateDAOImpl$7.doInHibernate(HibernateDAOImpl.java:290) at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406) ... 57 more cn.com.daxtech.framework.exception.CcsException: org.springframework.orm.hibernate3.HibernateQueryException: crm_person is not mapped [select a.id, (select z.corp.shortName from cn.digitalpublishing.po.CrmCorpTypeRelationship z where z.id = a.department), a.code, a.contractType, a.name, a.createOn, (select z.name from crm_person z where z.id = (SELECT x.person.id from cn.digitalpublishing.po.CrmPersonTypeRelationship x where x.id = a.createBy)), a.dateBegin, a.dateEnd, a.otherInfo, a.remark, a.approveStatus from cn.digitalpublishing.po.CrRightQt a]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: crm_person is not mapped [select a.id, (select z.corp.shortName from cn.digitalpublishing.po.CrmCorpTypeRelationship z where z.id = a.department), a.code, a.contractType, a.name, a.createOn, (select z.name from crm_person z where z.id = (SELECT x.person.id from cn.digitalpublishing.po.CrmPersonTypeRelationship x where x.id = a.createBy)), a.dateBegin, a.dateEnd, a.otherInfo, a.remark, a.approveStatus from cn.digitalpublishing.po.CrRightQt a] at cn.digitalpublishing.service.impl.CrRightQtServiceImpl.getPagingList(CrRightQtServiceImpl.java:81) at sun.reflect.GeneratedMethodAccessor459.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at com.sun.proxy.$Proxy415.getPagingList(Unknown Source) at cn.digitalpublishing.springmvc.controller.rightLicense.CrRightQtController.manager(CrRightQtController.java:85) at sun.reflect.GeneratedMethodAccessor457.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at cn.digitalpublishing.filter.LanguageFilter.doFilter(LanguageFilter.java:30) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at cn.com.daxtech.framework.web.filter.sso.PermissionFilter.doFilter(PermissionFilter.java:162) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: org.springframework.orm.hibernate3.HibernateQueryException: crm_person is not mapped [select a.id, (select z.corp.shortName from cn.digitalpublishing.po.CrmCorpTypeRelationship z where z.id = a.department), a.code, a.contractType, a.name, a.createOn, (select z.name from crm_person z where z.id = (SELECT x.person.id from cn.digitalpublishing.po.CrmPersonTypeRelationship x where x.id = a.createBy)), a.dateBegin, a.dateEnd, a.otherInfo, a.remark, a.approveStatus from cn.digitalpublishing.po.CrRightQt a]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: crm_person is not mapped [select a.id, (select z.corp.shortName from cn.digitalpublishing.po.CrmCorpTypeRelationship z where z.id = a.department), a.code, a.contractType, a.name, a.createOn, (select z.name from crm_person z where z.id = (SELECT x.person.id from cn.digitalpublishing.po.CrmPersonTypeRelationship x where x.id = a.createBy)), a.dateBegin, a.dateEnd, a.otherInfo, a.remark, a.approveStatus from cn.digitalpublishing.po.CrRightQt a] at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:656) at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412) at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411) at org.springframework.orm.hibernate3.HibernateTemplate.executeFind(HibernateTemplate.java:343) at cn.com.daxtech.framework.orm.hibernate3.dao.impl.HibernateDAOImpl.getListByHql(HibernateDAOImpl.java:288) at cn.digitalpublishing.dao.CrRightQtDao.getPagingList(CrRightQtDao.java:15) at cn.digitalpublishing.service.impl.CrRightQtServiceImpl.getPagingList(CrRightQtServiceImpl.java:79) ... 53 more Caused by: org.hibernate.hql.ast.QuerySyntaxException: crm_person is not mapped [select a.id, (select z.corp.shortName from cn.digitalpublishing.po.CrmCorpTypeRelationship z where z.id = a.department), a.code, a.contractType, a.name, a.createOn, (select z.name from crm_person z where z.id = (SELECT x.person.id from cn.digitalpublishing.po.CrmPersonTypeRelationship x where x.id = a.createBy)), a.dateBegin, a.dateEnd, a.otherInfo, a.remark, a.approveStatus from cn.digitalpublishing.po.CrRightQt a] at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:180) at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:111) at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:93) at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:327) at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3441) at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3325) at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:733) at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:584) at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExpr(HqlSqlBaseWalker.java:2321) at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExprList(HqlSqlBaseWalker.java:2121) at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectClause(HqlSqlBaseWalker.java:1522) at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:593) at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:301) at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:244) at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:256) at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:187) at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:138) at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101) at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80) at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124) at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156) at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135) at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1770) at sun.reflect.GeneratedMethodAccessor285.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.orm.hibernate3.HibernateTemplate$CloseSuppressingInvocationHandler.invoke(HibernateTemplate.java:1282) at com.sun.proxy.$Proxy7.createQuery(Unknown Source) at cn.com.daxtech.framework.orm.hibernate3.dao.impl.HibernateDAOImpl$7.doInHibernate(HibernateDAOImpl.java:290) at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406) ... 57 more
日志很多,挑重点看,crm_person is not mapped
</pre></p><p>还有,在错误中,还有这样一句话。.</p><p>select a.id, (select z.corp.shortName from cn.digitalpublishing.po.CrmCorpTypeRelationship z where z.id = a.department), a.code, </p><p>和</p><p>(select z.name from crm_person z where z.id = (SELECT x.person.id from cn.digitalpublishing.po.CrmPersonTypeRelationship x where x.id = a.createBy)),</p><p></p><p>从这两句,我感觉到,应该是找不到 我写的crm_person .</p><p> 我的sql语句是从sql中直接复制的,</p><p>XML配置文件,如下:</p><p><pre name="code" class="html"><query> <id>getPagingList</id> <method>getPagingList</method> <params> <param name="condition" type="java.util.Map"></param> <param name="sort" type="java.lang.String"></param> </params> <properties>id, department, code, contractType, name, createOn, createBy, dateBegin, dateEnd, otherInfo, remark, approveStatus</properties> <fields>a.id, (select z.corp.shortName from CrmCorpTypeRelationship z where z.id = a.department), a.code, a.contractType, a.name, a.createOn, (select z.name from crm_person z where z.id = (SELECT x.person.id from CrmPersonTypeRelationship x where x.id = a.createBy)), a.dateBegin, a.dateEnd, a.otherInfo, a.remark, a.approveStatus</fields> <hql>from CrRightQt a</hql> <conditions> <condition id="id" discribe="ID"> <params type="param"> <param name="id" type="java.lang.String" /> </params> <hql>a.id = ?</hql> </condition> <condition id="department" discribe="部门"> <params type="param"> <param name="department" type="java.lang.String" /> </params> <hql>a.department like ?</hql> </condition> <condition id="code" discribe="合同编号"> <params type="param"> <param name="code" type="java.lang.String" /> </params> <hql>a.code like ?</hql> </condition> <condition id="contractType" discribe="合同类型"> <params type="param"> <param name="contractType" type="java.lang.String" /> </params> <hql>a.contractType like ?</hql> </condition> <condition id="name" discribe="合同名称"> <params type="param"> <param name="name" type="java.lang.String" /> </params> <hql>a.name like ?</hql> </condition> <condition id="createBy" discribe="创建人"> <params type="param"> <param name="createBy" type="java.lang.String" /> </params> <hql>a.createBy like ?</hql> </condition> <condition id="otherInfo" discribe="第三方信息"> <params type="param"> <param name="otherInfo" type="java.lang.String" /> </params> <hql>a.otherInfo like ?</hql> </condition> <condition id="remark" discribe="备注"> <params type="param"> <param name="remark" type="java.lang.String" /> </params> <hql>a.remark like ?</hql> </condition> <condition id="approveStatus" discribe="审批状态"> <params type="param"> <param name="approveStatus" type="java.lang.String" /> </params> <hql>a.approveStatus like ?</hql> </condition> </conditions> <group></group> <order></order> <className>cn.digitalpublishing.po.CrRightQt</className> </query>
看重点,如下:
<fields>a.id, (select z.corp.shortName from CrmCorpTypeRelationship z where z.id = a.department), a.code, a.contractType, a.name, a.createOn, (select z.name from crm_person z where z.id = (SELECT x.person.id from CrmPersonTypeRelationship x where x.id =
a.createBy)), a.dateBegin, a.dateEnd, a.otherInfo, a.remark, a.approveStatus</fields>
hql,识别 类名,但是,不识别表名,所以报错 is not mapped,
修改crm_person 为CrmPerson ,类名,运行成功
时间: 2024-10-28 04:42:00