Category
protected long _id;
protected IList _sortRalSiteSortMaps;配置文件
<class name="Category" table="Category">
<id name="Id" type="Int64" unsaved-value="null">
<column name="CategoryId" length="8" sql-type="bigint" not-null="true" unique="true" index="PK_Category"/>
<generator class="native" />
</id>
<bag name="SortRalSiteSortMaps" inverse="true" lazy="true" cascade="all-delete-orphan">
<key column="SortID"/>
<one-to-many class="RalSiteSortMap"/>
</bag>
</class>RalSiteSortMap (关系表,)
protected long _id;
protected Category _sort;
配置文件
<id name="Id" type="Int64" unsaved-value="null">
<column name="id" length="8" sql-type="bigint" not-null="true" unique="true" index="PK_RalSiteSortMap"/>
<generator class="native" />
</id>
<many-to-one name="Sort" class="Category">
<column name="SortID" length="8" sql-type="bigint" not-null="true"/>
</many-to-one>外键也建立好.
分类表Category,关系表RalSiteSortMap . 关系表中存放的是分类的ID
问题描述:当我向分类表插入数据时. 当关系表为空时,正常执行插入语句.当关系表不为空时,会报identifier of an instance of NHModel.Entities.RalSiteSortMap was altered from 16 to 1的错误.
百思不得其解,望指教
protected long _id;
protected IList _sortRalSiteSortMaps;配置文件
<class name="Category" table="Category">
<id name="Id" type="Int64" unsaved-value="null">
<column name="CategoryId" length="8" sql-type="bigint" not-null="true" unique="true" index="PK_Category"/>
<generator class="native" />
</id>
<bag name="SortRalSiteSortMaps" inverse="true" lazy="true" cascade="all-delete-orphan">
<key column="SortID"/>
<one-to-many class="RalSiteSortMap"/>
</bag>
</class>RalSiteSortMap (关系表,)
protected long _id;
protected Category _sort;
配置文件
<id name="Id" type="Int64" unsaved-value="null">
<column name="id" length="8" sql-type="bigint" not-null="true" unique="true" index="PK_RalSiteSortMap"/>
<generator class="native" />
</id>
<many-to-one name="Sort" class="Category">
<column name="SortID" length="8" sql-type="bigint" not-null="true"/>
</many-to-one>外键也建立好.
分类表Category,关系表RalSiteSortMap . 关系表中存放的是分类的ID
问题描述:当我向分类表插入数据时. 当关系表为空时,正常执行插入语句.当关系表不为空时,会报identifier of an instance of NHModel.Entities.RalSiteSortMap was altered from 16 to 1的错误.
百思不得其解,望指教
解决方案 »
- c# 如何通过webservice传递XML字符串??
- 最近打算学学 ,所以特此发布 F#简体中文语言包
- 用C#工程 编译生成的 dll 怎么包含图片啊(如gif图片)?
- 该进程无法访问文件C:\Documents and Settings\Bird\桌面\log.txt,因为该文件正由另一进程使用
- <醒目><加强醒目>设置listview的行高度</加强醒目></醒目>
- 我是c#的新手
- 安装VS2008和SQL2008的问题
- 在屏幕指定位置如何打开其他EXE
- 有关.net的SDK更新的问题(会者接分)
- access批量插入不报错,数据库还是为空。
- 求正则表达式 关于博客采集 满意有加分
- C#简单问题
{
ISession session = NHelper.GetCurrentSession();
ITransaction it = session.BeginTransaction();
bool flag = true;
try
{
session.Save(item);
session.Flush();
it.Commit();
}
catch (Exception ex)
{
flag = false;
it.Rollback();
throw (ex);
}
return flag;
}
执行函数