The following types may not be used as proxies 异常处理办法
下面的文章转载于http://hi.baidu.com/zsea/blog/item/7d999e3d8a54c203baa1678d.html
一、Test.Model.Person.hbm.xml(2,2): XML validation error: 未能找到元素“urn:nhibernate-mapping-2.0:hibernate-mapping”的架构信息。
将2.0改为2.2
二、 The following types may not be used as proxies:
Test.Model.Person: method set_Id should be virtual
Test.Model.Person: method get_Name should be virtual
Test.Model.Person: method set_Name should be virtual
Test.Model.Person: method get_Id should be virtual
类配置文件中Class的Lazy改为false
网上搜到的三种解决方案:
1. You can follow the advice of the exception and add "virtual" to all of your properties, and make sure your class is non-sealed. Obviously you'll want to do this if you think you might want to take advantage of the lazy-initializing proxy feature. However, changing your classes may not be practical or advisable if you have a legacy codebase, or it may just bother you that a "transparent" persistence framework is dictating how you design certain aspects of your value classes. That's where Options 2 and 3 come in. Both of those involve changing back to the old behavior.
name="NorthwindClasses.Category, NorthwindClasses"
table="Categories"
lazy="false"
>
转载于:https://blog.51cto.com/jasonjn/1283105
The following types may not be used as proxies 异常处理办法相关推荐
- NHibernate初学体验记
NHibernate 是一个基于.Net 的针对关系型数据库的对象持久化类库.NHibernate 来源于优秀的基于Java的关系型持久化工具Hibernate.NHibernate持久化你的.Net ...
- [NHibernate]基本配置与测试
目录 写在前面 nhibernate文档 搭建项目 映射文件 持久化类 辅助类 数据库设计与连接配置 测试 总结 写在前面 一年前刚来这家公司,发现项目中使用的ORM是Nhibernate,这个之前确 ...
- NHibernate配置引发的异常
NHibernate.Cfg.Configuration"的类型初始值设定项引发异常 .添加引用 log4net.dll Iesi.Collections.dll NHibernate.d ...
- NHibernate应用二:第一个NHibernate程序
当前期工作都准备完成后,将开始NHibernate的学习过程,而在第一个NHibernate程序中,将实现通过NHibernate根据客户编号对客户表进行单条记录的查询示例.该示例中,我们将按以下几部 ...
- Nhibernate一些问题解决方法
问题1.未能找到元素"urn:nhibernate-mapping-2.0:hibernate-mapping"的架构信息. file:///c:/inetpub/wwwroot/ ...
- NHibernate错误集锦及配置技巧
前一段时间在学习NHibernate的时候,被那些配置弄得糊里糊涂,有一些很细微的地方不知道错在哪里,花了很多的时间去寻找,最后才调试通过,这里我就把遇到错误的地方以及怎么解决这些错误的方法贴出来,至 ...
- NHibernate 异常及解决办法(长期添加中)
Mapping 错误: 1) Could not determine type for:Namespance.Class,AssemblyName, for columns: NHibernate.M ...
- Speerio Skinergy 'Image' is ambiguous 错误
使用BeyondCSS皮肤时报错: Could Not Load Skin: /Portals/0/Skins/beyondcss/1column_speerio.ascx Error: E:&quo ...
- NHibernate入门实例
转:http://www.cnblogs.com/huhai121/p/3955755.html NHibernate应用一:环境准备 本章将介绍整个开发环境所需开发和数据库工具,以及数据库设计,后续 ...
最新文章
- MapReduce: 提高MapReduce性能的七点建议【译】
- oracle sql判断相等,Oracle PL/SQL判断两个字段相等或不等问题
- Angular依赖注入机制的一个错误消息:Error Cannot instantiate cyclic dependency!
- mqtt如何判断设备离线_反渗透纯水设备膜元件如何离线清洗?
- lucene中write.lock索引锁机制的原理
- .net core 获取binary 文件_Linux操作系统文件目录
- 安装Labview2012 “labview 2012 未定义必须的 NIPathsDir属性 maxAFWDIR”
- ESXi添加第三方驱动
- ScrollView中布局不能充满ScrollView的问题
- 逐步揭示makop.mkp勒索病毒中毒防范恢复解密
- Spring学习:通过黎活明视频1
- html中三角函数表示什么,三角函数的化一公式
- 《麦肯锡结构化战略思维》:4大原则 5个步骤,快速了解一个行业
- 华为鸿蒙os操作系统有pc版,华为开源操作系统 鸿蒙OS 升级版曝光,打通PC等一大批硬件...
- ios9遇到 App Transport Security has blocked a cleartext HTTP(http://) resource load 错误
- 阿里云吴翰清:从技术人转型做产品经理是一种什么样的体验
- java 实现仿word2007字数统计功能
- Python可视化库——plotnine学习和基本使用(二):theme工具库的介绍
- Kubernetes 单节点安装Clickhouse
- 感恩工作平台心得体会_感恩工作心得体会范文3篇