nhibernate配置问题

chenyu112 2011-12-28 05:17:29
配置文件:TbAgent

<class name="sms.Model.TbAgent,sms.Model" table="Agent" lazy="true">

<id name="Id" column="Id" type="Int32" unsaved-value="0">
<generator class="native"/> </id>
<property column="AgentId" type="Int32" name="AgentId" not-null="true" />
<property column="AgentName" type="String" name="AgentName" not-null="true" length="1024" />
<property column="MobilePhone" type="String" name="MobilePhone" not-null="true" length="1024" />
<bag name="TbSend" inverse="true" lazy="true">
<key column="RecPhone" not-null="true" />
<one-to-many class="sms.Model.TbSend,sms.Model" not-found="ignore"/>
</bag>
</class>
TbSend
<class name="sms.Model.TbSend,sms.Model" table="Tb_Send" lazy="false">

<id name="Id" column="Id" type="Int64" unsaved-value="0"> </id>
<property column="RecPhone" type="String" name="RecPhone" not-null="true" length="1073741823" />
<property column="SendTime" type="DateTime" name="SendTime" not-null="true" />
<many-to-one name="TbAgent" class="sms.Model.TbAgent,sms.Model">
<column name="MobilePhone"/>
</many-to-one>
</class>
2个表是一对多的关系(TbAgent是父)关系设置成 tbsend.recphone = tbagent.mobilephone
写的HQL:select a from TbAgent a inner join a.TbSend b
跟踪到的时tbsend.recphone = tbagent.id,不知道为什么?
谁能给我解释一下啊!
我的原帖:http://topic.csdn.net/u/20111224/11/7a27b9d7-4337-4b9d-9c9b-a654e31454cc.html


...全文
74 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
chenyu112 2011-12-30
  • 打赏
  • 举报
回复
此贴见 http://topic.csdn.net/u/20111224/11/7a27b9d7-4337-4b9d-9c9b-a654e31454cc.html

解决方法就是用property-ref属性解决

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧