-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Newbie Help - '...hibernate-maping' element is not declared.
PostPosted: Wed Jul 04, 2007 9:42 am 
Newbie

Joined: Wed Jul 04, 2007 9:25 am
Posts: 3
Hibernate version:
NHibernate: 1.2.0.GA

Platform
Visual Studio .NET 2005 - .Net 2.0
Microsoft SQL Server 2000

Hi guys,

I've just downloaded NHibernate and I'm trying to get the "Quickstart with IIS and Microsoft SQL Server" working. And I'm having a few problems :S hoping someone can point me in the right direction.

I'm getting the error:
"The 'urn:nhibernate-mapping-2.2:hibernate-maping' element is not declared."

All the code is, with a few connection string changes straight from the sample.

And my solution is set up as a website, with the erroring line of code (see below) on the Page_Load of the default.aspx.cs. And my Class, Mapping and NHibernateHelper in a class library called QuickStart.

I'm hoping a have a bit of syntax wrong or I'm missing something or doing something silly.




This is what I have in my web.config:
Code:
   <!-- Add this element -->
   <configSections>
      <section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
   </configSections>

   <!-- Add this element -->
   <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
      <session-factory>
         <property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
         <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
         <property name="connection.connection_string">Initial Catalog=quickstart;Data Source=.\SQLEXPRESS;User ID=sa;Password=computer;Persist Security Info=True</property>
         <mapping assembly="QuickStart"/>
      </session-factory>
   </hibernate-configuration>


this is what I have in my mapping file:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-maping xmlns="urn:nhibernate-mapping-2.2" namespace="QuickStart" assembly="QuickStart">
   <class name="Cat" table="Cat">

      <!-- A 32 hex character is our surrogate key. It is automatically
         generated by NHibernate with the UUID pattern.   -->
      <id name="Id">
         <column name="CatId" sql-type="char(32)" not-null="true" />
         <generator class="uuid.hex" />
      </id>

      <!-- A cat has to have a name, but it shouldn't be too long. -->
      <property name="Name">
         <column name="Name" length="16" not-null="true" />
      </property>
      <property name="Sex" />
      <property name="Weight" />
   </class>
   
</hibernate-maping>


This is the code in my Page_Load
Code:
ISession session = NHibernateHelper.GetCurrentSession();


And this is the constructor of the NHibernateHelper class where the exception is firing, on the sessionFactory = new Configuration().Configure().BuildSessionFactory();
Code:
using System;
using System.Web;
using NHibernate;
using NHibernate.Cfg;

namespace QuickStart
{
    public sealed class NHibernateHelper
    {
        private const string CurrentSessionKey = "nhibernate.current_session";
        private static readonly ISessionFactory sessionFactory;

        static NHibernateHelper()
        {
            sessionFactory = new Configuration().Configure().BuildSessionFactory();
        }

        public static ISession GetCurrentSession()
        {
.
.
.


Hoping I'm not asking an annoying question.

Thanks in advance
Dave


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 04, 2007 9:53 am 
Newbie

Joined: Wed Jul 04, 2007 9:25 am
Posts: 3
:ashamed:


ok ok I found out what I was doing wrong, thanks to the main man James for this....


Typo!
Code:
<hibernate-maping xmlns="urn:nhibernate-mapping-2.2" namespace="QuickStart" assembly="QuickStart">


Should have been
Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="QuickStart" assembly="QuickStart">


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.