这是 HQL 查询:
SELECT COUNT(s)
FROM Site s JOIN s.topics t
INNER JOIN t.topicExpertAssignment tea
INNER JOIN tea.expert u
INNER JOIN u.userinfo info
WHERE tea.assignedBy.id = 1 AND s.createdBy = tea.expert.id
ORDER BY s.name
当我第一次尝试运行此HQL
查询时,它会生成org.hibernate.exception.SQLGrammerException: could not execute query
异常,当我尝试再次运行此查询时,它会生成org.hibernate.exception.GenericJDBCEXception: could not execute query
异常。没有COUNT()
查询成功运行。如何解决此异常并提前致谢。