关注JEECG发展历程 关注最新动态和版本, 记录JEECG成长点滴 更新日志 - 技术支持 - 招聘英才

JEECG最新版本下载 JEECG智能开发平台 - 显著提高开发效率 常见问题 - 入门视频 - 参与开源团队

商务QQ: 69893005、418799587 商务热线(5*8小时): 010-64808099 官方邮箱: jeecgos@163.com

查看: 12017|回复: 1

[代码生成器] 数据库查询失败

[复制链接]
发表于 2017-11-16 09:51:24 | 显示全部楼层 |阅读模式
本帖最后由 xyznad 于 2017-11-16 10:03 编辑

使用online开发,并生成代码植入项目中,但是查询时报以下错误,请问是什么原因?
PS: 字段匹配都是正确的

@RequestMapping(params = "datagrid")
public void datagrid(TNhCaseEntity tNhCase,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
   CriteriaQuery cq = new CriteriaQuery(TNhCaseEntity.class, dataGrid);
   //查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, tNhCase, request.getParameterMap());
   try{
   //自定义追加查询条件
String query_cAfsj_begin = request.getParameter("cAfsj_begin");
   String query_cAfsj_end = request.getParameter("cAfsj_end");
   if(StringUtil.isNotEmpty(query_cAfsj_begin)){
      cq.ge("cAfsj", new SimpleDateFormat("yyyy-MM-dd").parse(query_cAfsj_begin));
   }
   if(StringUtil.isNotEmpty(query_cAfsj_end)){
      cq.le("cAfsj", new SimpleDateFormat("yyyy-MM-dd").parse(query_cAfsj_end));
   }
   }catch (Exception e) {
      throw new BusinessException(e.getMessage());
   }
   cq.add();
   this.tNhCaseService.getDataGridReturn(cq, true);
   TagUtil.datagrid(response, dataGrid);
}


错误消息:
[2017-11-16 09:43:35] [ERROR] [org.jeecgframework.core.common.exception.GlobalExceptionResolver:86] 全局处理异常捕获:
org.hibernate.QueryException: could not resolve property: cAfsj of: com.jeecg.sasys.entity.TNhCaseEntity
    at org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:83)
    at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:77)
    at org.hibernate.persister.entity.AbstractEntityPersister.getSubclassPropertyTableNumber(AbstractEntityPersister.java:1832)
    at org.hibernate.persister.entity.BasicEntityPropertyMapping.toColumns(BasicEntityPropertyMapping.java:61)
    at org.hibernate.persister.entity.AbstractEntityPersister.toColumns(AbstractEntityPersister.java:1807)
    at org.hibernate.loader.criteria.CriteriaQueryTranslator.getColumns(CriteriaQueryTranslator.java:522)
    at org.hibernate.loader.criteria.CriteriaQueryTranslator.findColumns(CriteriaQueryTranslator.java:537)
    at org.hibernate.criterion.SimpleExpression.toSqlString(SimpleExpression.java:66)
    at org.hibernate.loader.criteria.CriteriaQueryTranslator.getWhereCondition(CriteriaQueryTranslator.java:419)
    at org.hibernate.loader.criteria.CriteriaJoinWalker.<init>(CriteriaJoinWalker.java:110)
    at org.hibernate.loader.criteria.CriteriaJoinWalker.<init>(CriteriaJoinWalker.java:92)
    at org.hibernate.loader.criteria.CriteriaLoader.<init>(CriteriaLoader.java:93)
    at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1516)
    at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:374)
    at org.hibernate.internal.CriteriaImpl.uniqueResult(CriteriaImpl.java:396)
    at org.jeecgframework.core.common.dao.impl.GenericBaseCommonDao.getDataGridReturn(GenericBaseCommonDao.java:699)
    at org.jeecgframework.core.common.service.impl.CommonServiceImpl.getDataGridReturn(CommonServiceImpl.java:246)
    at sun.reflect.GeneratedMethodAccessor417.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

发表于 2017-11-20 10:43:34 | 显示全部楼层
hibernate实体和数据库字段不匹配
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表