摘要:概述: 在Nhibernate对数据记录进行更新的时候,如果对同一条记录进行重复执行修改时,出现如下错误: a different object with the same identifier value was already associated with the session: 25, of entity: Model.JkptOaxtWeatherforecast. 解决办法...
阅读全文
02 2009 档案
摘要:概述: 当使用Nhibernate查询表中的数据时,如果表中存在复合主键,如果没有在相应的实体类中重写Equals(),那么将会出现"Could not compile the mapping document: TestCleanSnow.JkptGlxtUser.hbm.xml".当跟踪出错的内部信息的时候会发现,内部异常为"composite-id class must overrid...
阅读全文
摘要:概述: 在用Nhibernate查询所返回的数据为IList,而我们经常需要的却是DataSet,所以很有必要这么一个方法. 代码: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->/**/ /// /...
阅读全文
摘要:概述: 当运行 session.Save(tnp);时,出现这个"Unknown entity class: TestCleanSnow.TestNhibernatePerson"这个异常. 映射文件 TestNhibernatePerson.hbm.xml如下: Code highlighting produced by Actipro CodeHighlighter ...
阅读全文
摘要:转自官方文档:http://logging.apache.org/log4net/release/config-examples.html log4net Config Examples Overview This document presents example configurations for the built-in appenders. These configuratio...
阅读全文
摘要:我用的是Oracle9i,应用程序app.config的配置如下" Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> NHibernate.Dialect.MsSql2000D...
阅读全文
摘要:主键产生器 可选项说明: 1) assigned 主键由外部程序负责生成,无需NHibernate参与。 2) hilo 通过hi/lo 算法实现的主键生成机制,需要额外的数据库表保存主 键生成历史状态。 3) seqhilo 与hilo 类似,通过hi/lo 算法实现的主键生成机制,只是主键历史 状态保存在Sequence中,适用于支持Sequence的数据库,如Oracle。 4) incr...
阅读全文
摘要:1建立数据表 Code Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->create table Test_Increase( userid number(10) primary key, /*主键,自动增加*/ ...
阅读全文
摘要:代码如下: Configuration config = new Configuration(); config.AddAssembly("TestCleanSnow"); ISessionFactory factory = config.BuildSessio...
阅读全文
摘要:在执行 session.Save(cs); 时,出现could not get next sequence value[SQL: SQL not available] Nhibernate 解决办法: 把相应XML的 改为 以上我做Oracle时出现的错误,操作sqlserver的时候应该为 .
阅读全文
摘要:在加载映射文件及相应的类文件的引用时 Configuration config = new Configuration(); config.AddAssembly("TestCleanSnow"); 出现如下异常: Could not compile the mapping document: TestCleanSnow.BjkptOaxtCleanupsnow...
阅读全文
摘要:在 ISessionFactory factory = config.BuildSessionFactory();时发生 NHibernate.InvalidProxyTypeException: The following types may not be used as proxies: TestCleanSnow.BjkptOaxtCleanupsnow: method set_IsDele...
阅读全文
摘要:概述: 复制表的结构(只复制表结构,源表名:b_Jkpt_Oaxt_Trafficaccident 新表名:Test_OAXT_TrafficAccident) Oralce语句: create table Test_OAXT_TrafficAccident as select * from b_Jkpt_Oaxt_Trafficaccident where 1=2
阅读全文