0

试图从这里开始这个 SQL:

SELECT DISTINCT iss.ID
FROM            Issue AS iss
INNER JOIN      Message ON Message.IssueID = iss.ID
INNER JOIN      Clinician ON Clinician.UserID = Message.FromUserID
INNER JOIN      OrgUnit ON OrgUnit.ID = Clinician.OrgUnitID
WHERE           OrgUnit.ID = [id-number]

在 HQL 中:

select distinct iss.id from iss
inner join iss.messages as msg
inner join msg.Sender.OrgUnit as org
where org = :orgUnit

但我不断收到“无法绑定多部分标识符”

映射:
-- 问题 --

<bag name="messages" access="field" inverse="false" lazy="true" cascade="none">
  <key column="IssueID" />
  <one-to-many class="Message" />
</bag>

-- 临床医生 --

<joined-subclass name="Clinician" table="Clinician" lazy="true">
  <key column="UserID" />
  <many-to-one name="OrgUnit" column="OrgUnitID" />
</joined-subclass>

4

1 回答 1

1

刚刚发现解决这个问题的最简单方法是避免它。它确实在 SQL 中工作,所以为什么不只在 SQL 中做呢。

于 2009-08-23T16:09:02.423 回答