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: bad configuration or cant find dialect problem
PostPosted: Thu Oct 08, 2009 4:49 pm 
Beginner
Beginner

Joined: Thu Oct 08, 2009 11:44 am
Posts: 21
Location: Chicago
I have almost all the peices in place for a C# (visual studio 2008) console application with nhibernate.

I get a runtime error

NHibernate.MappingException: Could not compile the mapping document: BDM_Controller.Source.ORM.DB_Accounts.hbm.xml ---> System.InvalidOperationException: Could not find the dialect in the configuration
at NHibernate.Dialect.Dialect.GetDialect(IDictionary`2 props)
at NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument doc)
--- End of inner exception stack trace ---
at NHibernate.Cfg.Configuration.LogAndThrow(Exception exception)
at NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument doc)
at NHibernate.Cfg.Configuration.ProcessMappingsQueue()
at NHibernate.Cfg.Configuration.AddDocumentThroughQueue(NamedXmlDocument document)
at NHibernate.Cfg.Configuration.AddXmlReader(XmlReader hbmReader, String name)
at NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream, String name)
at NHibernate.Cfg.Configuration.AddResource(String path, Assembly assembly)
at NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly)
at NHibernate.Cfg.Configuration.AddAssembly(String assemblyName)
at BDM_Controller.SchwabProvider.transformAccountFile(CustomersDataTable customersDataTable) in C:\VisualStudioApps\BDM\Source\BDM Controller\Providers\Schwab\SchwabProvider.cs:line 103

It ccomplains that it can't compile my BDM_Controller.Source.ORM.DB_Accounts.hbm.xml config for an Accounts table

I have in the config:


<nhibernate>
<add
key="hibernate.connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"
/>
<add
key="hibernate.dialect"
value="NHibernate.Dialect.MsSql2005Dialect"
/>
<add
key="hibernate.connection.driver_class"
value="NHibernate.Driver.SqlClientDriver"
/>
<add
key="hibernate.connection.connection_string"
value="Server=localhost;initial catalog=MvAccountInfoDB;Persist Security Info=True;User ID=<uid>;Password=<psw>"
/>
</nhibernate>


and the DB_ACcounts.hbm.xml is large but here is a partial source


<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
namespace="BDM_Controller.Source.ORM."
assembly="BDM_Controller">
<class name="DB_Accounts" table="Accounts" lazy="false">
<id name="AccountNumber" type="String" length="9"/>
<property name="ShortTitle" type="String" length="36"/>
<property name="AlphaListNumber" type="String" length="7"/>
<property name="AdminOffCode" type="String" length="3"/>
<property name="AltAdmin1" type="String" length="3"/>
<property name="AltAdmin2" type="String" length="3"/>


...


<property name="ValuationFee1PaymentMethod" type="String" length="1"/>
<property name="ValuationFee2Schedule" type="String" length="3"/>
<property name="ValuationFee2PaymentMethod" type="String" length="1"/>
<property name="RelationshipCode" type="String" length="7"/>
</class>
</hibernate-mapping>

The messages are not clear if this is really a compile problem with the hbm.xml or it just can find the dialect, or do I need a dialect reference somewhere else?

This is from NHibernate 2.1.0.GA

Using MS SQL Server 2005 , Visual Studio 2008

any ideas o a fix would be appreciated.

---John Putnam


Top
 Profile  
 
 Post subject: Re: bad configuration or cant find dialect problem
PostPosted: Thu Oct 08, 2009 6:23 pm 
Beginner
Beginner

Joined: Thu Oct 08, 2009 11:44 am
Posts: 21
Location: Chicago
I got further by doing a cnf.Configure("app.config") but still won't complie my hbm.xml.

I get:

NHibernate.MappingException: Could not compile the mapping document: BDM_Controller.Source.ORM.DB_Accounts.hbm.xml --->
System.InvalidOperationException: There is an error in XML document (1, 2). --->
System.InvalidOperationException: <hibernate-mapping xmlns='urn:nhibernate-configuration-2.2'> was not expected.

On the same hbm.xml above. I have stripped out the class section, same result, stripped out the parameters in the hibernate-mapping tag, same result (but you can see that it is looking at that tag.

I wish there were better more complete examples for the current version of the library.

Any ideas appreciated (if they solve the issue at hand, of course)

Thanks,

---John Putnam


Top
 Profile  
 
 Post subject: Re: bad configuration or cant find dialect problem
PostPosted: Tue Oct 13, 2009 12:36 am 
Newbie

Joined: Mon Oct 12, 2009 4:35 am
Posts: 3
Location: Thailand
Hi there,

Try right click on your hbm.xml file and make sure it's Build Action is set to "Embedded Resource". See if that works!

Good Luck

_________________
Vishan S Gill
Tuple Solutions Co., Ltd.
Web Solution Analyst
Email: vsgill@tuple.co.th / vishan.s.gill@gmail.com


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.