数据库查询失败
本帖最后由 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);
}
错误消息:
全局处理异常捕获:
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)
hibernate实体和数据库字段不匹配
页:
[1]