【发布时间】:2012-04-18 04:44:22
【问题描述】:
我有两张表,一张用于派对,一张用于记分卡模板映射。记分卡模板映射表有一个外键返回该方(在 id 上)。我想查找具有记分卡模板映射详细信息的所有各方的列表。
但我收到一条错误消息:
java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException:意外令牌: 在第 1 行附近,第 172 列 [选择新的 ScorecardTemplateMapping(p,temMap.scoTemplate,temMap.wrkFlwTemplate) from com.kpisoft.common.web.domain.Party p 左外连接 ScorecardTemplateMapping temMap on temMap.organization.id=p.id 和 temMap.gradeType.id=:gradeType 其中 p.organization.organizationTypeId=:orgType 和 p.clientId=:clientId 按 p.organization.name 排序]
这是我的查询:
查询 q = entityManager.createQuery("select new ScorecardTemplateMapping(p,temMap.scoTemplate,temMap.wrkFlwTemplate) from Party p left outer join ScorecardTemplateMapping temMap on temMap.organization.id=p.id 和 temMap.gradeType.id=:gradeType 其中 p.organization.organizationTypeId=:orgType 和 p.clientId=:clientId 按 p.organization.name 排序");
我不知道为什么这不起作用。请帮忙!
【问题讨论】: