I created a Class Project using Visual C# Express which has the Persistent Class file as well as the hbm file as embedded resource, and referenced the DLL in Visual Web Express (as suggested by people on the forum).
However i get a error like this :-
Could not find schema information for the element 'urn:NHibernate-mapping-2.0:hibernate-mapping'.
I am new to nHibernate. Please help.
Thanks.
Hibernate version:
1.2.0.1001
Mapping documents:
?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:NHibernate-mapping-2.0">
<class name="NHibernate.Examples.QuickStart.User, NHibernate.Examples" table="users">
<id name="Id" column="LogonId" type="String" length="20">
<generator class="assigned" />
</id>
<property name="UserName" column="Name" type="String" length="40"/>
<property name="Password" type="String" length="20"/>
<property name="EmailAddress" type="String" length="40"/>
<property name="LastLogon" type="DateTime"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
ISession session = factory.OpenSession();
ITransaction transaction = session.BeginTransaction();
NHibernate.Examples.QuickStart.User newUser = new NHibernate.Examples.QuickStart.User();
newUser.Id = "joe_cool";
newUser.UserName = "Joseph Cool";
newUser.Password = "abc123";
newUser.EmailAddress = "
[email protected]";
newUser.LastLogon = DateTime.Now;
// Tell NHibernate that this object should be saved
session.Save(newUser);
// commit all of the changes to the DB and close the ISession
transaction.Commit();
session.Close();
Full stack trace of any exception that occurs:
[XmlSchemaException: Could not find schema information for the element 'urn:NHibernate-mapping-2.0:hibernate-mapping'.]
NHibernate.Cfg.Configuration.ValidationHandler(Object o, ValidationEventArgs args) in c:\net\nhibernate\nhibernate\src\NHibernate\Cfg\Configuration.cs:1562
System.Xml.Schema.BaseValidator.SendValidationEvent(XmlSchemaException e, XmlSeverityType severity) +58
System.Xml.Schema.BaseValidator.SendValidationEvent(String code, String msg, XmlSeverityType severity) +127
System.Xml.Schema.XsdValidator.ProcessElement(Object particle) +311
System.Xml.Schema.XsdValidator.ValidateElement() +192
System.Xml.Schema.XsdValidator.Validate() +68
System.Xml.XmlValidatingReaderImpl.ProcessCoreReaderEvent() +125
System.Xml.XmlValidatingReaderImpl.Read() +44
System.Xml.XmlValidatingReader.Read() +12
System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace) +791
System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) +51
System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) +278
System.Xml.XmlDocument.Load(XmlReader reader) +97
NHibernate.Cfg.Configuration.LoadMappingDocument(XmlTextReader hbmReader) in c:\net\nhibernate\nhibernate\src\NHibernate\Cfg\Configuration.cs:1539
NHibernate.Cfg.Configuration.AddXmlReader(XmlTextReader hbmReader) in c:\net\nhibernate\nhibernate\src\NHibernate\Cfg\Configuration.cs:1556
NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream) in c:\net\nhibernate\nhibernate\src\NHibernate\Cfg\Configuration.cs:416
[MappingException: Could not find schema information for the element 'urn:NHibernate-mapping-2.0:hibernate-mapping'.]
NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream) in c:\net\nhibernate\nhibernate\src\NHibernate\Cfg\Configuration.cs:426
NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly, Boolean skipOrdering) in c:\net\nhibernate\nhibernate\src\NHibernate\Cfg\Configuration.cs:598
NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly) in c:\net\nhibernate\nhibernate\src\NHibernate\Cfg\Configuration.cs:552
NHibernate.Cfg.Configuration.AddAssembly(String assemblyName) in c:\net\nhibernate\nhibernate\src\NHibernate\Cfg\Configuration.cs:533
_Default.Page_Load(Object sender, EventArgs e) +41
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +13
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +45
System.Web.UI.Control.OnLoad(EventArgs e) +80
System.Web.UI.Control.LoadRecursive() +49
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3743
Name and version of the database you are using:
SQL 2005 Express
Connection string :-
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt: