Could not find the dialect in the configuration

68 views
Skip to first unread message

Lychee

unread,
Aug 28, 2009, 12:37:40 AM8/28/09
to nhusers
I am new to nHibernate and not sure if this is the probably place to
ask questions.
I am trying to use nHibernate 2.0.1.4 in .net 3.5 vs 2008. So I create
a console app, but when I run my console app, I always get the
following errors,not sure what happens here:

Unhandled Exception: NHibernate.MappingException: Could not compile
the mapping
document: NhibernateProject.TestCase.hbm.xml --->
System.InvalidOperationEx
ception: 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 docu
ment)
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 NhibernateProject.Program.Main(String[] args) in D:\test project
\Nhibernat
eProject\NhibernateProject\Program.cs:line 15

The TestCase.hbm.xml is the following:
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="NhibernateProject" default-lazy="false" auto-import="true"
namespace="NhibernateProject">
<class name ="TestCase" table="test_case" lazy="false">
<id name ="Id" column="id">
<generator class="assigned"></generator>
</id>
<property name="UserId" column="user_id"></property>
<property name="Notation" column="notation"></property>
</class>
</hibernate-mapping>


The Nhibernate.config is the following:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns ="urn:nhiberate-configuration-2.2">
<session-factory name="Test">
<property name="dialect">NHibernate.Dialect.Sybase11Dialect</
property>
<property
name="connection.provider">NHibernate.Connection.DriverConnectionProvider</
property>
<property
name="connection.driver_class">NHibernate.Driver.SybaseOdbcDriver</
property>
<property
name="connection.connection_string">SRVR=Test;DB=Test_db;
UID=test;password=test;driver={Sybase System 11}</property>
<property name="connection.isolation">ReadUncommitted</property>
<property name="show_sql">true</property>
<mapping assembly ="NhibernateProject"></mapping>
</session-factory>
</hibernate-configuration>

I also have created a class with name TestCase.cs.

Thanks for any replying.
Press any key to continue . . .

Lychee

unread,
Aug 31, 2009, 12:53:54 AM8/31/09
to nhusers
Any one got any ideas with this? Thanks

Oskar Berggren

unread,
Aug 31, 2009, 3:25:34 AM8/31/09
to nhu...@googlegroups.com
Are you loading the correct config file? (just a quick guess)

/Oskar


2009/8/31 Lychee <ell...@gmail.com>:

Billy Stack

unread,
Aug 31, 2009, 11:08:06 AM8/31/09
to nhu...@googlegroups.com
This is because the hibernate-configuration is not being picked up.

Is your hibernate-configuration in a file named "hibernate.config.xml"?

If so ensure "hibernate.config.xml" is copied to the output directory...

Lychee

unread,
Sep 1, 2009, 12:46:23 AM9/1/09
to nhusers
Yeah, finally I work around this. The hibernate.config isn't picked
up.
so I use the below codes to pick the config file
" Configuration cfg = new Configuration();
cfg.Configure("hibernate.config");"
Thanks for any reply.

On Sep 1, 1:08 am, Billy Stack <bs.st...@gmail.com> wrote:
> This is because the hibernate-configuration is not being picked up.
>
> Is your hibernate-configuration in a file named "hibernate.config.xml"?
>
> If so ensure "hibernate.config.xml" is copied to the output directory...
>
>
>
> On Mon, Aug 31, 2009 at 8:25 AM, Oskar Berggren<oskar.bergg...@gmail.com> wrote:
>
> > Are you loading the correct config file? (just a quick guess)
>
> > /Oskar
>
> > 2009/8/31 Lychee <elli...@gmail.com>:
> >>> Press any key to continue . . .- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages