我有一个观点:
CREATE VIEW [SZV].[ViewMembership]
AS
SELECT DISTINCT
a.ID, a.RIZIVNr, a.Denomination, a.FirstInsDate, c.ID AS HcwId, e.BCEKBO AS CbeEstablishmentNr, d.ID AS TypeCodeId, d.Code AS TypeCodeCode, d.DescriptionNL,
d.DescriptionFR, g.ID AS TypeSitCodeId, g.Code AS SitCode, g.DescriptionFR AS SitDescriptionFR, g.DescriptionNL AS SitDescriptionNL, f.ID AS SitCodeId,
f.SitBegDate, f.SitEndDate, c.RIZIVNr AS LidRizivNr, a.LastSitID, c.LastSitID AS MemberLastSitID, n.Code AS MemberSitCode,
n.DescriptionFR AS MemberSitDescriptionFR, n.DescriptionNL AS MemberSitDescriptionNL, j.FirstName1, j.FirstName2, j.LastName, j.INSS,
h.FromDate AS StartDatum, k.Code AS RolCode, k.DescriptionFR AS RolDescriptionFR, k.DescriptionNL AS RolDescriptionNL, h.ToDate AS EindDatum,
m.ID AS AddressId, m.Street, m.StreetNr, m.Box, m.Locality, m.ZipCode, m.INSCode, p.AttributeValueID AS AttributValueId, p.AttributeID, r.Code AS AttributeCode,
q.AttributeValue, s.Code AS ProfCodeCode, s.DescriptionNL AS ProfDescriptionNL, s.DescriptionFR AS ProfDescriptionFR, h.ID AS HcwSitId, u.ID AS RequestId,
u.HCWID AS RequestForId, x.RIZIVNr AS RequestedForRizivNr, u.ToDate AS RequestToDate, u.FromDate AS RequestFromDate, u.RequestedBy,
v.Code AS RequestRolCode, v.DescriptionFR AS RequestRolDescriptionFR, v.DescriptionNL AS RequestRolDescriptionNL,
w.FirstName1 + ' ' + w.LastName AS RequestedByName, y.FirstName1 AS RequestedForFirstName1, y.FirstName2 AS RequestedForFirstName2,
y.LastName AS RequestedForLastName, y.INSS AS RequestedForINSS, z.ID AS HciAttributeRequestId, z.RequestedBy AS HciAttributeRequestedBy
FROM SZV.HCI AS a INNER JOIN
SZV.HCWHCI AS b ON a.ID = b.HCIID INNER JOIN
SZV.HCW AS c ON b.HCWID = c.ID INNER JOIN
Param.TypeCode AS d ON d.ID = a.TypeCodeID INNER JOIN
SZV.Org AS e ON e.ID = a.OrgID INNER JOIN
SZV.HCISit AS f ON f.ID IN
(SELECT MAX(ID) AS Expr1
FROM SZV.HCISit
WHERE (HCIID = a.ID)) INNER JOIN
Param.TypeSitCode AS g ON g.ID = f.SitCodeID INNER JOIN
SZV.HCWHCI AS h ON h.HCIID = a.ID AND h.HCWID = c.ID INNER JOIN
SZV.HCWSit AS o ON o.HCWID = c.ID INNER JOIN
Param.TypeSitCode AS n ON n.ID = o.SitCodeID INNER JOIN
SZV.Person AS j ON j.ID = c.PersonID INNER JOIN
Param.HCWRole AS k ON h.RoleID = k.ID INNER JOIN
SZV.HCIAddress AS l ON l.HCIID = a.ID INNER JOIN
Param.ProfCode AS s ON s.ID = c.ProfCodeID INNER JOIN
SZV.Address AS m ON m.ID = l.AddressID LEFT OUTER JOIN
SZV.HCIAttribute AS p ON p.HCIID = a.ID LEFT OUTER JOIN
Param.AttributeValue AS q ON p.AttributeValueID = q.ID LEFT OUTER JOIN
Param.Attribute AS r ON r.ID = p.AttributeID AND r.Code = 'TherapeuticLink' LEFT OUTER JOIN
SZV.HCWHCIRequest AS u ON u.HCIID = a.ID AND u.HCWID = c.ID AND u.Validated = 0 AND u.Canceled = 0 LEFT OUTER JOIN
Param.HCWRole AS v ON u.RoleID = v.ID LEFT OUTER JOIN
SZV.Person AS w ON w.INSS = u.RequestedBy LEFT OUTER JOIN
SZV.HCW AS x ON u.HCWID = x.ID LEFT OUTER JOIN
SZV.Person AS y ON x.PersonID = y.ID LEFT OUTER JOIN
SZV.HCIAttributeRequest AS z ON z.HCIID = a.ID AND z.Validated = 0 AND z.Canceled = 0
WHERE (d.Code IN ('805', '212', '214'))
现在,当我使用NHibernate获取结果时,我收到以下错误: {“查看或功能'SZV.ViewMembership'不可更新,因为修改会影响多个基表。”}
{“查看或功能'SZV.ViewMembership'不可更新,因为修改会影响多个基表。”}
我使用的代码如下:
ICriteria selectCriteria = this.CreateCriteria();
var or = Restrictions.Disjunction();
if (groupId != 0)
{
var restrHciId = Restrictions.Eq("Id", groupId);
or.Add(restrHciId);
}
selectCriteria.Add(or);
IList<Group> groupsList = this.Find(selectCriteria).ToList();
我不是在尝试更新视图中的任何内容。 任何人都可以帮助我吗?
答案 0 :(得分:0)
您只能更新&#34;更新查询&#34;一个视图 对于来自多个表的两个Col您必须使用多个查询:)