-->
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: A new issue when connecting MS Access with NHibernate-2.1.0
PostPosted: Wed Jun 17, 2009 1:17 am 
Newbie

Joined: Wed Jun 17, 2009 1:07 am
Posts: 3
I'm trying to connect MS Access via JetDriver( with VS2008, Winform application). There is an error:

Quote:
"InnerException {"Unable to cast object of type 'NHibernate.JetDriver.JetDbConnection' to type 'System.Data.Common.DbConnection'."} System.Exception {System.InvalidCastException}
StackTrace " at DataAccess.NHibernateHelper.GetCurrentSession()\r\n at MemberManagement.MemberDetail.MemberDetail_Load(Object sender, EventArgs e) in C:\\Users\\admin\\Documents\\Visual Studio 2008\\Projects\\MemberManagement\\MemberManagement\\Forms\\MemberDetail.cs:line 60" string
StackTrace " at NHibernate.Tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.Prepare() in c:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Tool\\hbm2ddl\\SuppliedConnectionProviderConnectionHelper.cs:line 25\r\n at NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.GetReservedWords(Dialect dialect, IConnectionHelper connectionHelper) in c:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Tool\\hbm2ddl\\SchemaMetadataUpdater.cs:line 43\r\n at NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.Update(ISessionFactory sessionFactory) in c:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Tool\\hbm2ddl\\SchemaMetadataUpdater.cs:line 17\r\n at NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping mapping, Settings settings, EventListeners listeners) in c:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Impl\\SessionFactoryImpl.cs:line 169\r\n at NHibernate.Cfg.Configuration.BuildSessionFactory() in c:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Cfg\\Configuration.cs:line 1090\r\n at DataAccess.NHibernateHelper..cctor() in C:\\Users\\admin\\Documents\\Visual Studio 2008\\Projects\\MemberManagement\\DataAccess\\NHibernateHelper.cs:line 22"


I'm so new with NHibernate. Any help is welcome. In meantime, I will try to update NHibernate source code and try to fix something.


Top
 Profile  
 
 Post subject: Re: A new issue when connecting MS Access with NHibernate-2.1.0
PostPosted: Wed Jun 17, 2009 1:27 am 
Newbie

Joined: Wed Jun 17, 2009 1:07 am
Posts: 3
Maybe, I have to change some code in JetDriver. I will make JetDbConnection override DbConnection in place of implementing IDbConnection interface. That's just an ideal...


Top
 Profile  
 
 Post subject: Re: A new issue when connecting MS Access with NHibernate-2.1.0
PostPosted: Thu Jun 18, 2009 1:06 am 
Newbie

Joined: Wed Jun 17, 2009 1:07 am
Posts: 3
It's done now, I made JetDbConnection inherit DbConnection.
There's still another problem with property "Transaction" of JetDbCommand. In setter, the value is usually OleDbTransaction in place of JetDbTransaction. So, there is an casting exception with line:
Quote:
_transaction = (JetDbTransaction) value;


In meantime, I change this line of code to:
Quote:
_transaction = value is JetDbTransaction?(JetTransaction)value:new JetDbTransaction(this._connection,(OleDbTransaction) value);


I think the new one is still not good. Do you have any ideal?


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.