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.  [ 1 post ] 
Author Message
 Post subject: "Could not load type NHibernate.JetDriver.JetDialect&qu
PostPosted: Wed Nov 26, 2008 10:28 am 
Beginner
Beginner

Joined: Wed Nov 19, 2008 7:27 am
Posts: 26
Location: Germany
Hiho...

I've a problem with the Jet-Driver.
Log4Net tells me that NHibernate could not find the Jet Driver.

Where do I have to fix this?

My Config:

Code:
// Enable the logging of NHibernate operations
            log4net.Config.XmlConfigurator.Configure();
           
            NHibernate.Cfg.Configuration cfg = new NHibernate.Cfg.Configuration();
            cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionProvider,
                "NHibernate.Connection.DriverConnectionProvider");
            cfg.SetProperty(NHibernate.Cfg.Environment.ProxyFactoryFactoryClass,
                "NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle");
            switch (dbType)
            {
                case 1://Access
                    cfg.SetProperty(NHibernate.Cfg.Environment.Dialect, "NHibernate.JetDriver.JetDialect");
                    cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionDriver, "NHibernate.JetDriver.JetDriver");
                    cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionString, "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pathToDb + ";User-Id=admin;Password=;");
                    break;
                case 2://Access 2007
                    break;
                case 3://MSSQL
                    cfg.SetProperty(NHibernate.Cfg.Environment.Dialect, "NHibernate.Dialect.MsSql2000Dialect");
                    cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionDriver, "NHibernate.Driver.SqlClientDriver");
                    cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionString, "connectionString");
                    break;
                case 4://SqlCE
                    cfg.SetProperty(NHibernate.Cfg.Environment.Dialect, "NHibernate.Dialect.MsSqlCeDialect");
                    cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionDriver, "NHibernate.Driver.SqlServerCeDriver");
                    cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionString,"Data Source=" + pathToDb );
                    break;
            }

            cfg.AddAssembly("Database");
            MemoryStream stream = new MemoryStream();
            ////Ask NHibernate to use fields instead of Properties
            NHibernate.Mapping.Attributes.HbmSerializer.Default.Validate = true; //Enable Validation
            NHibernate.Mapping.Attributes.HbmSerializer.Default.HbmDefaultAccess = "field.camelcase-underscore";
            // Gather information from this assembly (can also be done class by class)
           NHibernate.Mapping.Attributes.HbmSerializer.Default.Serialize( stream,
          System.Reflection.Assembly.GetExecutingAssembly() );
            stream.Position = 0;
          
            cfg.AddInputStream(stream); // Send the Mapping information to NHibernate Configuration
           stream.Close();
            new NHibernate.Tool.hbm2ddl.SchemaExport(cfg).Create(true, true);
            _sessionFactory = cfg.BuildSessionFactory();


With SqlCE, everything went fine.
What is wrong here?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.