若非java相关的战友,直接点评即可,无需仔细阅读文章
org.springframework.scheduling.quartz.JobMethodInvocationFailedException: Invocation of method 'execute' on target class [class com.znz.util.NodeResScheduler] failed; nested exception is org.hibernate.QueryException: could not resolve property: nodeId of: com.znz.entity.domain.CompanyResPool [select count(id) from com.znz.entity.auth.CompanyEntity c,com.znz.entity.domain.CompanyResPool p where p.nodeId = 12]
错误代码:
String str="select count(id) from CompanyEntity c,CompanyResPool p where p.nodeId = "+ nodeId;
解决方案:
String str="select count(id) from CompanyEntity c,CompanyResPool p where p.node.node_id = "+ nodeId;
解析:hql是属性的sql,所以要.node然后.node里面的nodeid所对应的字段名,才能够查询得到。