日期:2014-05-20  浏览次数:20901 次

NHibernate中many-to-one问题
当前文件名为EmployeeDate.hbm.xml,其中有
<many-to-one  
name= "department "
access= "field "
column= "DEPARTMENTID "
class= "AMS.Common.domain.external.DepartmentData,   Common "/>

这个多对一影射到底影射的是什么?请高手详细逐句说明一下。谢谢


------解决方案--------------------
name= "department "——表名称
access= "field "
column= "DEPARTMENTID "——表里面的字段名称
class= "AMS.Common.domain.external.DepartmentData, Common "/> ——类名
举例:有两个表,部门department,员工Employee,每个员工都有一个部门,一个部门有多个员工,这是对应关系,Employee的字段DEPARTMENTID关联到department的字段DEPARTMENTID;
上面的配置文件就表现了这种关系,文件名是EmployeeDate.hbm.xml,说明这是Employee表对应的实体类的配置文件,这就说明在Employee表中的字段DEPARTMENTID对应到department表的DEPARTMENTID