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.  [ 5 posts ] 
Author Message
 Post subject: Getting started - second obstable - user doc
PostPosted: Sun Nov 16, 2008 3:10 pm 
Newbie

Joined: Mon Nov 10, 2008 4:03 pm
Posts: 11
Just getting started still. I've digested every example with config info I can find. I'm now looking at the NH documentation, specifically Chapter 3.1, Programmatic Configuration.

Hibernate version: 2.0.1GA

I am using ActiveWriter to create the hbm files (target set to embedded resource).

According to the documentation, I should be able to 1. create config object and then 2. add an assembly.

1. NHibernate.Cfg.Configuration cfg = new NHibernate.Cfg.Configuration();

2. The documentation just has ".AddAssembly("MyProject");", but I know it has to be "cfg.AddAssembly("MyProject");".

It's on this line that I get the error:

"Could not compile the mapping document: MyProject.UserSetting.hbm.xml"

"UserSetting" is just one of my tables and one of the corresponding hbm files. If I remove this file from the ActiveWriter diagram and remove this hbm file (so it's as if I'm not using this table from the db), one of my other 10 table names goes in its place and gives same error. Hence, I know it's not table-specific, but coming from something else.

I was going to use one of the other methods as indicated in the documentation (same section, 3.1), but the other two methods require that I list every class/table name. And the one I'm using is the 3rd listed and is listed as "best" method. If I can get it to work, I see now maintenance there as I add tables/classes.

Here's the stack. Hope someone has an idea...

Could not find the dialect in the configuration
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Could not find the dialect in the configuration

Source Error:


Line 22: // Add class mappings to configuration object
Line 24: cfg.AddAssembly("MyProject");


Source File: C:\inetpub\ASPNET\MyProject\Default.aspx.cs Line: 24

Stack Trace:


[InvalidOperationException: Could not find the dialect in the configuration]
NHibernate.Dialect.Dialect.GetDialect(IDictionary`2 props) +201
NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument doc) +163

[MappingException: Could not compile the mapping document: MyProject.UserSetting.hbm.xml]
NHibernate.Cfg.Configuration.LogAndThrow(Exception exception) +132
NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument doc) +369
NHibernate.Cfg.Configuration.ProcessMappingsQueue() +51
NHibernate.Cfg.Configuration.AddDocumentThroughQueue(NamedXmlDocument document) +53
NHibernate.Cfg.Configuration.AddXmlReader(XmlReader hbmReader, String name) +72
NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream, String name) +159
NHibernate.Cfg.Configuration.AddResource(String path, Assembly assembly) +281
NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly) +252
NHibernate.Cfg.Configuration.AddAssembly(String assemblyName) +227
MyProject._Default.Page_Load(Object sender, EventArgs e) in C:\inetpub\ASPNET\MyProject\Default.aspx.cs:24
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627


I just noticed I"m using the doc for version 1.2.0. The NH version I have is the latest (beta) of 2.0.1GA. Did this implementation for configuring NH change between these two versions, could that be the problem I'm having?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 17, 2008 3:40 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Yes, there're breaking changes in the configuration:


# <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"

There is a special thread for those:
http://forum.hibernate.org/viewtopic.php?t=985289

If that doesn't help, post your configuration.

_________________
--Wolfgang


Top
 Profile  
 
 Post subject: breaking changes... in June/July...
PostPosted: Mon Nov 17, 2008 12:46 pm 
Newbie

Joined: Mon Nov 10, 2008 4:03 pm
Posts: 11
Thanks for the response. Now at least I know it's not something I'm not understanding.

Thing is... as a beginner, it would be helpful to have either 1) updated documentation for these changes/breaks and 2) a complete ASP.NET C# example project (simple).

Know where I can get either/both of these?


Top
 Profile  
 
 Post subject: breaking changes... in June/July...
PostPosted: Mon Nov 17, 2008 12:47 pm 
Newbie

Joined: Mon Nov 10, 2008 4:03 pm
Posts: 11
Thanks for the response. Now at least I know it's not something I'm not understanding.

Thing is... as a beginner, it would be helpful to have either 1) updated documentation for these changes/breaks and 2) a complete ASP.NET C# example project (simple).

Know where I can get either/both of these?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 18, 2008 3:41 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Have a look at http://www.nhforge.org. There are lot's of blogs, how-tos and samples.

_________________
--Wolfgang


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