-->
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.  [ 2 posts ] 
Author Message
 Post subject: Nhibernate, Mono & SQLite
PostPosted: Thu Jan 14, 2010 12:40 pm 
Newbie

Joined: Thu Oct 23, 2008 4:42 am
Posts: 4
I'm trying to use NHibernate to manage my entities in a mono application that uses SQLite for it's database. Every time I try and run the application I get the following error:
Code:
Unhandled Exception: NHibernate.MappingException: Could not compile the mapping document: RugbyManager.Player.hbm.xml ---> System.InvalidOperationException: Could not find the dialect in the configuration
  at NHibernate.Dialect.Dialect.GetDialect (IDictionary`2 props) [0x00000] in <filename unknown>:0
  at NHibernate.Cfg.Configuration.AddValidatedDocument (NHibernate.Cfg.NamedXmlDocument doc) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at NHibernate.Cfg.Configuration.LogAndThrow (System.Exception exception) [0x00000] in <filename unknown>:0
  at NHibernate.Cfg.Configuration.AddValidatedDocument (NHibernate.Cfg.NamedXmlDocument doc) [0x00000] in <filename unknown>:0
  at NHibernate.Cfg.Configuration.ProcessMappingsQueue () [0x00000] in <filename unknown>:0
  at NHibernate.Cfg.Configuration.AddDocumentThroughQueue (NHibernate.Cfg.NamedXmlDocument document) [0x00000] in <filename unknown>:0
  at NHibernate.Cfg.Configuration.AddXmlReader (System.Xml.XmlReader hbmReader, System.String name) [0x00000] in <filename unknown>:0
  at NHibernate.Cfg.Configuration.AddInputStream (System.IO.Stream xmlInputStream, System.String name) [0x00000] in <filename unknown>:0


My Nhibernate config is in my App.Config file (which is embedded):
Code:
<configuration>
   <!-- Configuration Sections In This File -->
    <configSections>

        <!-- NHibernate Section -->
        <section
            name="hibernate-configuration"
            type="NHibernate.Cfg.ConfigurationSectionHandler,NHibernate"
        />
       
        <!-- NHibernate Configuration -->
       <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
          <session-factory>
             <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
              <property name="connection.driver_class">NHibernate.Driver.SQLite20Driver</property>
              <property name="connection.connection_string">
                  Data Source=rugbyManager.db,version=3
              </property>
              <property name="dialect">NHibernate.Dialect.SQLiteDialect</property>
              <property name="query.substitutions">true=1;false=0</property>
              <property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>

           </session-factory>
       </hibernate-configuration>

    </configSections>

</configuration>


The code I'm using to initialise things is as follows:
Code:
         Configuration config = new Configuration();
         Assembly thisAssembly = typeof(Player).Assembly;
         config.AddAssembly(thisAssembly);
         config.Properties.Add("proxyfactory.factory_class", "NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu");
         config.Properties.Add("dialect", "NHibernate.Dialect.SQLiteDialect");
         config.Configure();
         factory = config.BuildSessionFactory();


Is anyone able to explain why this isn't working for me?


Top
 Profile  
 
 Post subject: Re: Nhibernate, Mono & SQLite
PostPosted: Mon May 02, 2011 6:15 pm 
Newbie

Joined: Mon May 02, 2011 6:12 pm
Posts: 1
You have reversed the order of your calls; you need to call Configure() before AddAssembly(). I ran into this too, it was very annoying. See my blog post for more. http://developmentality.wordpress.com/2 ... e-example/

I have another one in the works for SQLite.


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