我有两张桌子和一个视图:
TABLE "Table_1" (
"Id" INTEGER NOT NULL DEFAULT AUTOINCREMENT,
"Field_1" VARCHAR(11) NOT NULL,
PRIMARY KEY ( "Id" ASC )
) IN "system";
TABLE "Table_2" (
"Table_1_Id" INTEGER NOT NULL, //// (THIS FIELD HAVE A FOREIGN KEY WITH TABLE "Table_1" FIELD "Id")
"Field_2" VARCHAR(11) NOT NULL,
PRIMARY KEY ( "Table_1_Id" ASC )
) IN "system";
VIEW "vwView_1"()
AS
select
Id,
Field_1,
Field_2
from Table_1 key join Table_2
这是查看地图:
...
Table("vwView_1");
Mutable(false);
Id(x => x.Id);
Property(x => x.Field_1);
Property(x => x.Field_2);
...
这是数据库中的视图数据:
Id Field_1 Field_2
1 Green Blue
1 Green Red
2 Black White
3 Orange Blue
6 Red Orange
6 Red Green
当我使用 nHibernate 获取数据时,我得到了以下数据:
Id Field_1 Field_2
1 Green Blue
1 Green Blue
2 Black White
3 Orange Blue
6 Red Orange
6 Red Orange
我认为问题出在查看地图中,但我找不到解决此问题的方法:(
有人有解决办法吗?