【发布时间】:2014-09-05 05:00:53
【问题描述】:
我正在尝试按照 hql 查询来执行
SELECT count(*)
FROM BillDetails as bd
WHERE bd.billProductSet.product.id = 1002
AND bd.client.id = 1
但它正在显示
org.hibernate.QueryException: illegal attempt to dereference collection
[billdetail0_.bill_no.billProductSet] with element property reference [product]
[select count(*) from iland.hbm.BillDetails as bd where bd.billProductSet.product.id=1001 and bd.client.id=1]
at org.hibernate.hql.ast.tree.DotNode$1.buildIllegalCollectionDereferenceException(DotNode.java:68)
at org.hibernate.hql.ast.tree.DotNode.checkLhsIsNotCollection(DotNode.java:558)
【问题讨论】:
-
你能添加你的类的定义吗?它们是否包含关系定义?
标签: hibernate hql jpa-2.0 dereference jpa-2.1