未能找到属性“name”的架构信息,是什么错啊,求解!

失去乐山贼 2011-04-12 01:35:36
消息 2 未能找到元素“urn:nhibernate-configuration-2.2:session-factory”的架构信息。 E:\NHibernateDemo\webTest_pro\webTest\App.config 13 6 webTest
消息 3 未能找到元素“urn:nhibernate-configuration-2.2:property”的架构信息。 E:\NHibernateDemo\webTest_pro\webTest\App.config 14 8 webTest
消息 4 未能找到属性“name”的架构信息。 E:\NHibernateDemo\webTest_pro\webTest\App.config 14 17 webTest
消息 5 未能找到元素“urn:nhibernate-configuration-2.2:property”的架构信息。 E:\NHibernateDemo\webTest_pro\webTest\App.config 15 8 webTest
消息 6 未能找到属性“name”的架构信息。 E:\NHibernateDemo\webTest_pro\webTest\App.config 15 17 webTest
消息 7 未能找到元素“urn:nhibernate-configuration-2.2:property”的架构信息。 E:\NHibernateDemo\webTest_pro\webTest\App.config 16 8 webTest
消息 8 未能找到属性“name”的架构信息。 E:\NHibernateDemo\webTest_pro\webTest\App.config 16 17 webTest
消息 9 未能找到元素“urn:nhibernate-configuration-2.2:mapping”的架构信息。 E:\NHibernateDemo\webTest_pro\webTest\App.config 19 8 webTest
消息 10 未能找到属性“assembly”的架构信息。 E:\NHibernateDemo\webTest_pro\webTest\App.config 19 16 webTest


好像是配置文件的标签认不出来,但是我 刚学,不知道怎么了。求大侠回答~,谢了。



...全文
802 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
失去乐山贼 2011-04-12
  • 打赏
  • 举报
回复
网上说,
Test.Model.Person.hbm.xml(2,2): XML validation error: 未能找到元素“urn:nhiberna
te-mapping-2.0:hibernate-mapping”的架构信息。
引起问题的原因:
原来是因为版本有问题.网上找的版本都太低了,现在用VS2005修改配置信息就OK了.
解决办法
打开所对应的配置文件,把<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">改为
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">);

但是我的版本是2.2的。不用改。我不知道还要改什么版本。
失去乐山贼 2011-04-12
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 zhulong1111 的回复:]

NHibernate???
传送员
[/Quote]

是的,NHibernate,用Nunit测试。


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Spring.Data.NHibernate.Support;
using NHibernate;

namespace webTest
{
public class CatDao: HibernateDaoSupport
{

public void AddCat(Cat cat) {

HibernateTemplate.Save(cat);

}
}
}
失去乐山贼 2011-04-12
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 wxr0323 的回复:]

<property name="Code" column="Emp_Code" type="string" length="6"/>

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping
xmlns="urn:nhibernate-mapping-2.2"
namespace="Wipro.CompetenceB……
[/Quote]


这些个是提示App.Config中的标签:


<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<!-- 添加一个元素-->
<configSections>
<section
name="hibernate-configuration"
type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"
/>
</configSections>

<!-- 添加元素-->
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.connection_string">
Server=.;initial catalog=animals;User ID=sa;Pwd=123456;
</property>
<mapping assembly="animals" />
</session-factory>
</hibernate-configuration>

<!-- Leave the system.web section unchanged -->
<system.web>

</system.web>
</configuration>


zhulong1111 2011-04-12
  • 打赏
  • 举报
回复
NHibernate???
传送员
子夜__ 2011-04-12
  • 打赏
  • 举报
回复
<property name="Code" column="Emp_Code" type="string" length="6"/>

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping
xmlns="urn:nhibernate-mapping-2.2"
namespace="Wipro.CompetenceBuild.Entities"
assembly="Wipro.CompetenceBuild.Entities"
default-cascade="none"
default-lazy="true">

<class name="Employee" table="Emp">
<!-- Id property -->
<id name="Id" column="Emp_ID" type="long" unsaved-value="0">
<generator class="native">
<param name="sequence">
<!--TODO:sequence name defined by oracle-->
EMP_ID_SEQUENCE
</param>
</generator>
</id>
这样来配

62,046

社区成员

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

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

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

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