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.  [ 3 posts ] 
Author Message
 Post subject: Help with "Could not compile the mapping document"
PostPosted: Mon Feb 02, 2009 12:56 pm 
Newbie

Joined: Mon Feb 02, 2009 12:36 pm
Posts: 2
Hi all,

Very very new to nHibernate so I've come across a problem that is well documented but although I've searched extensively I can't find a solution - apologies if its obvious.

I'm using nHibernate 2.0.1GA (according to the release notes file)

I'm getting the error Could not compile the mapping document: RSSFeed.Core.Domain.RSSArticle.hbm.xml, the inner Exception is "Could not find the dialect in the configuration"

Below are the details of my setup:

<App.config>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section
name="nhibernate"
type="System.Configuration.NameValueSectionHandler, System,
Version=1.0.5000.0,Culture=neutral,
PublicKeyToken=b77a5c561934e089" />

</configSections>

<nhibernate>
<add key="connection.provider" value="NHibernate.Connection.DriverConnectionProvider" />
<add key="dialect" value="NHibernate.Dialect.MsSql2000Dialect" />
<add key="connection.driver_class" value="NHibernate.Driver.SqlClientDriver" />
<add key="connection.connection_string" value="Server=localhost;initial catalog=StockWatcher;Integrated Security=true;Min Pool Size=2" />
</nhibernate>
</configuration>

<RSSArticle.cs>
namespace RSSFeed.Core.Domain
{
[Serializable]
public class RSSArticle
{
public string articleId { get; set; }
public string title { get; set; }
public string description { get; set; }
public string link { get; set; }
public string pubDate { get; set; }
public string newsId { get; set; }

public RSSArticle()
{ }
}
}

<RSSArticle.hbm.xml>
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
namespace="RSSFeed.Core.Domain"
assembly="RSSFeed.Core">

<class name="RSSFeed.Core.Domain.RSSArticle, RSSFeed.Core" table="tblArticle" lazy="false">
<id name="articleId">
<column name="ArticleId" />
<generator class="native" />
</id>
<property name="title" column="Title" />
<property name="description" column="Summary" />
<property name="link" column="link" />
<property name="pubDate" column="dtPublished" />
<property name="newsId" column="NewsID" />

</class>
</hibernate-mapping>

<tblArticle>
ArticleID UNIQUEIDENTIFIER
Title VARCHAR(255)
Description VARCHAR(7000)
Link VARCHAR(255)
pubDate SMALLDATETIME
NewsID VARCHAR(128)

The code that fails:
namespace RSSFeed.Core.Domain
{
public class NHibernateSessionFactory
{
//Sess
public NHibernateSessionFactory()
{

Configuration config = new Configuration();
try
{
//config.Configure();
config.AddClass(typeof(RSSArticle));
config.BuildSessionFactory();
}
catch ( MappingException ex )
{
throw ex;
}

}
}
}

The database is running on Sql Server 2005 Enterprise edition.

I've got the RSSSArticle.hbm.xml file set to Build Action = "Embed Resource"

Any help would be greatly appreciated as I'm banging my head on the desk here!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 02, 2009 4:17 pm 
Expert
Expert

Joined: Fri May 13, 2005 5:56 pm
Posts: 308
Location: Santa Barbara, California, USA
Most likely this is related to how you have NH configured for the database you are using. Specifically, check your config for the "dialect" param. Here is a link to the 2.0.0 documentation that may help here:

http://nhforge.org/doc/nh/en/index.html#quickstart-intro

hth,

-devon


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 02, 2009 4:59 pm 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
"Breaking changes" ... sticky topic at the top of the forum ;-)

<nhibernate> section is ignored, using <hibernate-configuration> section (note that they have different XML formats)

Configuration values are no longer prefixed by "hibernate.", if before you would specify "hibernate.dialect", now you specify just "dialect"

Will perform validation on all named queries at initialization time, and throw exception if any is not valid.

_________________
--Wolfgang


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.