1 异常 [org.jeecgframework.core.common.exception.GlobalExceptionResolver]全局处理异常捕获:
org.hibernate.hql.internal.ast.QuerySyntaxException: expecting CLOSE, found 'null' near line 1, column 207 [SELECT id Fromcom.midea.mideashop.entity.admin.ProductEntity where productCategoryId = ? AND id IN (select productId AS id FROMproductFilterItemRelEntity where (filterItemId = ? AND filterItemValue = ?) ]
atorg.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54)
HQL语句
SELECT a.id From com.midea.mideashop.entity.admin.ProductEntitya where a.productCategoryId ='42' AND a.id IN (select b.productId AS id FROMproductFilterItemRelEntity b WHERE (b.filterItemId = ? AND b.filterItemValue =?) AND(b.filterItemId = ? ANDb.filterItemValue = ?)
原因:
少了 ------ ) 括号
2, 异常
[org.jeecgframework.core.common.exception.GlobalExceptionResolver]全局处理异常捕获:
org.hibernate.QueryParameterException: Position beyond number of declared ordinal parameters. Remember thatordinal parameters are 1-based! Position: 3
参数序数是从1开始,位置在 3 处。
实际错误为:
超出声明序数参数的位置
解决:检查 占位符 ‘?’ 是否和 传递的参数个数一致
3, 异常
Invalid path: 'b.filterItemId'
atorg.hibernate.hql.internal.ast.util.LiteralProcessor.lookupConstant(LiteralProcessor.java:119)
atorg.hibernate.hql.internal.ast.tree.DotNode.resolve(DotNode.java:220)
atorg.hibernate.hql.internal.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:119)
原因:
语句中没有对应的字段,有可能是在拼接或书写 hql 时,没有该字段