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.  [ 4 posts ] 
Author Message
 Post subject: "Could not find the dialect in the configuration"
PostPosted: Tue Aug 19, 2008 10:44 am 
Newbie

Joined: Mon Aug 18, 2008 10:17 am
Posts: 4
I've read the manual, I've had working code, I've searched the forums for a solution. Still nothing.

Now I was sure this new project was put together in much the same way as the old one, but I'm getting the "Could not find the dialect in the configuration" exception.

My App.conf configuration file is as follows:

Code:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
 
  <configSections>
    <section
        name="hibernate-configuration"
        type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
  </configSections>

  <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
      <property name="dialect">
        NHibernate.Dialect.MsSql2005Dialect
      </property>
      <property name="connection.provider">
        NHibernate.Connection.DriverConnectionProvider
      </property>
      <property name="connection.driver_class">
        NHibernate.Driver.SqlClientDriver
      </property>
      <property name="connection.connection_string">
        Data Source=developmentserver;Initial Catalog=mydb;Persist Security Info=True;User ID=sa;Password=secret;
      </property>
    </session-factory>
  </hibernate-configuration>

  <connectionStrings>
    <add name="HUGOS"
        connectionString="Data Source=developmentserver;Initial Catalog=mydb1;Persist Security Info=True;User ID=username;Password=secret."
        providerName="System.Data.SqlClient" />
    <add name="Security"
        connectionString="Data Source=developmentserver;Initial Catalog=mydb2;Persist Security Info=True;User ID=username;Password=secret."
        providerName="System.Data.SqlClient" />
    <add name="Directory"
        connectionString="Data Source=developmentserver;Initial Catalog=mydb3;Persist Security Info=True;User ID=username;Password=secret."
        providerName="System.Data.SqlClient" />
  </connectionStrings>
 
</configuration>



I have two libraries. One with my entities, and one with my data access code. My data access code is along the following lines:

Code:

        private ISession CreateSession<TObject>(TObject entity)
        {
            if (this._session == null)
            {
                this._configuration = new NHibernate.Cfg.Configuration();
                this._configuration.Configure();
                this._configuration.AddAssembly(typeof(TObject).Assembly);
                this._configuration.SetProperty("hibernate.connection.connection_string_name", this._connectionName);
                this._factory = this._configuration.BuildSessionFactory();
                this._session = this._factory.OpenSession();
                this._session.FlushMode = FlushMode.Commit;
            }
            else
            {
                if (this._session.IsOpen == true) { }
                else
                {
                    this._session = this._factory.OpenSession();
                }
            }

            return this._session;
        }



The App.conf is in my unit test library, which references both the entities and the data access libraries. This is driving me crazy. All help is appreciated.

Hibernate version: 2.0.0

Mapping documents:

Code:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">

  <class name="AJBG.Directory.Entities.Logs.Security_Log, AJBG.Directory.Entities" table="Security_Log" lazy="true">
    <id name="LogId" type="Int32">
      <generator class="native" />
    </id>
    <many-to-one name="LogType" column="LogType" not-null="true" fetch="join" cascade="none" />
    <property name="AccountName" type="String" length="20" not-null="false" insert="true" update="true" unique="false" />
    <property name="Message" type="String" not-null="true" />
  </class>
 
</hibernate-mapping>



Name and version of the database you are using:

Microsoft SQL Server 2005


Top
 Profile  
 
 Post subject: Resolved
PostPosted: Wed Aug 20, 2008 4:36 am 
Newbie

Joined: Mon Aug 18, 2008 10:17 am
Posts: 4
It turns out, for some unknown reason, the App.conf was not being copied to the build directory. Manually copying it fixed the issue, but now it's a matter of finding out why the .NET build process was ignoring the configuration file.


Top
 Profile  
 
 Post subject: Re: Resolved
PostPosted: Tue Feb 10, 2009 9:21 pm 
Newbie

Joined: Tue Feb 10, 2009 9:14 pm
Posts: 1
phillaszkowicz wrote:
It turns out, for some unknown reason, the App.conf was not being copied to the build directory. Manually copying it fixed the issue, but now it's a matter of finding out why the .NET build process was ignoring the configuration file.


Just set the "Copy to Output" of the App.conf to "Copy always" and you have it!
Do the same for any hbm.xml file.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 10, 2009 9:24 pm 
Newbie

Joined: Tue Feb 10, 2009 9:19 pm
Posts: 2
hm i dont have this file
where is locate it?
-----------------------------
www.awtoys.com


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