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: 'urn:hibernate-configuration-2.2:hibernate-configuration'?
PostPosted: Tue Oct 23, 2007 4:40 am 
Newbie

Joined: Tue Oct 23, 2007 4:32 am
Posts: 1
I've just start using NHibernate, and I'm trying to work with Northwind following the information on "Quickstart with IIS and Microsoft SQL Server" in the documentation.

I don't know why, but the configuration from the Web.Config was not worked well (There was an error says: "Please set the dialect"), so i tried to set the configuration in hbm.xml file:

Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
   <session-factory>
      <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
      <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
      <property name="connection.connection_string">Server=*****;catalog=Northwind;Integrated Security=True</property>
      <mapping assembly="Northwind" />
   </session-factory>
</hibernate-configuration>


When the configuration is loading i'm getting an error:
Code:
Configuration conf = new Configuration();
conf.AddFile(HttpContext.Current.Server.MapPath("~/hibernate.hbm.xml")); [b]<<<<< ERROR <<<<<[/b]
conf.AddFile(HttpContext.Current.Server.MapPath("~/Employee.hbm.xml"));
conf.Configure();
_SessionFactory = conf.BuildSessionFactory();


The error is:
Could not find schema information for the element 'urn:hibernate-configuration-2.2:hibernate-configuration'.


Google didn't help me:\

Does anyone knows what the problem?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 23, 2007 11:32 am 
Regular
Regular

Joined: Fri Jan 20, 2006 7:45 pm
Posts: 97
Location: San Antonio, TX
You've got the configuration in the wrong file. Either put it in web.config/app.config or in hibernate.cfg.xml. What you have there should be in hibernate.cfg.xml.

The config files are also not embedded resources like your hbm files usually are. I have Build Action set to 'Content' on my hibernate.cfg.xml.

The hbm files are only for mapping classes.

The error 'Please set the dialect' probably means you were missing something like this in your web.config:
Code:
<property name="dialect">NHibernate.Dialect.OracleDialect</property>


_________________
Dum spiro, spero
-------------------------------
Rate my post if it helps...


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.