NHibernate:未能找到元素“urn:nhibernate-mapping-2.0:hibernate-mapping”的架构信息。

边城的刀声 2007-10-17 08:11:24
执行:cfg.AddAssembly("OfficeSunLightDataModule")语句,提示如下错误

未能找到元素“urn:nhibernate-mapping-2.0:hibernate-mapping”的架构信息。


大家给个思路,不胜感激
...全文
848 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
parenth 2010-03-19
  • 打赏
  • 举报
回复
怎么看不到啊
virusswb 2008-06-17
  • 打赏
  • 举报
回复
一、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.

2. To change the lazy-initialization proxy setting for a specific class, you can add a "lazy='false'" attribute to the <class> mapping element. This might look something like:<class
name="NorthwindClasses.Category, NorthwindClasses"
table="Categories"
lazy="false"
> 3. To change the lazy-initialization proxy setting for all classes in a given mapping file, you can add a "default-lazy='false'" attribute to the <hibernate-mapping> element, as follows:<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" default-lazy="false"> Unfortunately, Option 3 doesn't really help you much if you do one <class> mapping per <hibernate-mapping> file, a practice which I personally follow and recommend. It's too bad, but there doesn't seem to be any way to set this default in the <nhibernate> global configuration. But if you do happen to have all of your <class>'s in one .hbm.xml file, "default-lazy" can help you out.
rydanliu 2007-11-04
  • 打赏
  • 举报
回复
是不是版本问题,试试urn:nhibernate-mapping-2.2:hibernate-mapping
saucer 2007-10-17
  • 打赏
  • 举报
回复
which version of NHibernate are you using? see

http://www.hibernate.org/407.html

Schema namespace
Update the XML schema reference in your hbm XML files. Change urn:nhibernate-mapping-2.0 to urn:nhibernate-mapping-2.2 in the hibernate-mapping element. If you get "XML validation error: Could not find schema information for the element 'urn:nhibernate-mapping-2.0:hibernate-mapping'", you forgot to change the namespace.

62,243

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

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