-->
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: Could not find the dialect in the configuration
PostPosted: Wed Jul 09, 2008 4:20 pm 
Newbie

Joined: Wed Jul 09, 2008 3:24 pm
Posts: 2
Hi
I'm trying to adapt quick start application to my code. I have MyClass.hbm.xml file

Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
  <class name="package.MyClass, package" table="tableName">
    <id name="Id" column="id" type="String" length="20">
      <generator class="assigned" />
    </id>
    <property name="field1" column="field1" type="String" length="90"/>
    <property name="field2" type="String" column="field2" length="20"/>
    <property name="field3" type="String" column="field3" length="20"/>
   
  </class>
</hibernate-mapping>


and my App,config is looking like that
Code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="log4net"
         type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />

    <section
      name="nhibernate"
      type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    />
  </configSections>

  <log4net>
    <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
      <param name="File" value="Log.txt" />
      <param name="AppendToFile" value="true" />
      <layout type="log4net.Layout.PatternLayout">
        <param name="Header" value="[Header]\r\n" />
        <param name="Footer" value="[Footer]\r\n" />
        <param name="ConversionPattern" value="%d [%t] %-5p %c %m%n" />
      </layout>
    </appender>

    <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
      <layout type="log4net.Layout.PatternLayout">
        <param name="Header" value="[Header]\r\n" />
        <param name="Footer" value="[Footer]\r\n" />
        <param name="ConversionPattern" value="%d [%t] %-5p %c %m%n" />
      </layout>
    </appender>

    <root>
      <level value="DEBUG" />
      <appender-ref ref="LogFileAppender" />
      <appender-ref ref="ConsoleAppender" />
    </root>
  </log4net>

  <nhibernate>
    <add
      key="hibernate.connection.provider"
      value="NHibernate.Connection.DriverConnectionProvider"
    />
    <add
      key="hibernate.dialect"
      value="NHibernate.Dialect.MySQLDialect"
    />
    <add
      key="hibernate.connection.driver_class"
      value="NHibernate.Driver.MySqlDataDriver"
    />
    <add
      key="hibernate.connection.connection_string"
      value="Server=localhost;Database=myDB;User ID=user;Password=passwd"
    />
  </nhibernate>
   
</configuration>


I have done all things from this tutorial and after
Quote:
Configuration cfg = new Configuration();
cfg.AddAssembly("package");
ISessionFactory factory = cfg.BuildSessionFactory();


I'm getting "Could not find the dialect in the configuration" error. I have moved MySql.cfg.xml.tmpl file from nHibernate to the root location of my application.

I have no idea why MySQLDialect could not be found - please help me, I'm stucked on this issue :(.

Regards
Jan


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 10, 2008 2:36 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Which version of nhibernate do you use ? If you use 2.0 this won't work:

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


from http://forum.hibernate.org/viewtopic.php?t=985289

_________________
--Wolfgang


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 10, 2008 2:49 am 
Newbie

Joined: Wed Jul 09, 2008 3:24 pm
Posts: 2
Hi
Thx for reply. I have downloaded latest 2.0.0.Beta1 version.

So, I will try hibernate-configuration instead of nhibernate:)

Regards
Jan


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.