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.  [ 5 posts ] 
Author Message
 Post subject: Porting Sqlite 3 to Nhibernate 1.0.3
PostPosted: Tue Dec 26, 2006 12:05 pm 
Newbie

Joined: Tue Dec 26, 2006 11:32 am
Posts: 4
Hello Nhibernate/Sqlite3 users !

As you may have heard "SQLite ADO.Net Provider" the initial project providing an ADO.NET driver for Sqlite is discontinued.

Instead, a new project sqlite-dotnet2 have started and keep providing nice ADO.NET driver.

As of today, Nhibernate only provides built-in support for the "SQLite ADO.Net Provider" driver which does not support Sqlite 3 ! Hopefully, "sqlite-dotnet2" does.

Ok long story short, you may find in the JIRA issue NH-846 the code (dll + source to use Sqlite 3 + Nhibernate 1.0.3 + sqlite-dotnet2.

The first patch seems to be Nhibernate 1.2 specific and doesn't work for 1.03. So I changed the original code (written by Ioan Bizau).

In the zip, you will find :
- the visual studio 2005/2003 project
- the code (yeah)
- debug and release dlls for .net 2.0 and .net 1.1

I've tested it with the following feature
- autoincrement
- BOOLEAN and DATE fields.

Bye,
Bertrand.

[url][/url]


Top
 Profile  
 
 Post subject: How to use this with .NET 1.1?
PostPosted: Mon Jan 29, 2007 7:41 pm 
Newbie

Joined: Sun Jul 30, 2006 3:54 am
Posts: 10
I would like to move from using the discontinued Finsar driver to this new sqlite-dotnet2 one.

However, we're still on .NET 1.1.

I've downloaded the zip, and have replaced my references to NHibernate and the Finsar ADO provider with references to the new (1.0.3) NHibernate DLL and NHibernate.SQLite20.dll i.e. where I previously had:

    NHibernate
    SQLite.NET

as references, I've now got:

    NHibernate (version 1.0.3)
    NHibernate.SQLite20


I've also amended my config file to refer to the new driver class:

Code:
<add key="hibernate.dialect" value="NHibernate.Dialect.SQLiteDialect" />
<add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider" />
<add key="hibernate.connection.driver_class" value="NHibernate.Driver.SQLite20Driver" />
<add key="hibernate.query.substitutions" value="true=1;false=0" />
<add key="hibernate.show_sql" value="true" />
<add key="hbm2ddl.auto" value="create" />

However, I'm having problems getting things to run (when previously they ran fine).

When trying to get a session using BuildSessionFactory, I get the error:

Quote:
A first chance exception of type 'System.TypeLoadException' occurred in nhibernate.dll

Additional information: Could not load type 'NHibernate.Driver.SQLite20Driver, NHibernate, Version=1.0.3.0, Culture=neutral, PublicKeyToken=null', check that type and assembly names are correct


Note that I haven't changed the version of ADO.NET - so am I missing something, like this driver only runs with ADO.NET 2.0?



Thanks,

James


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 30, 2007 5:36 am 
Newbie

Joined: Tue Dec 26, 2006 11:32 am
Posts: 4
Hello,

to have it right, you must include the assembly name.
So I would recommend :

<add key="hibernate.connection.driver_class" value="NHibernate.Driver.SQLite20Driver, NHibernate.SQLite20" />
<add key="hibernate.dialect" value="NHibernate.Dialect.SQLite20Dialect, NHibernate.SQLite20" />


Bertrand.

PS : don't forget to use the new dialect :)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 30, 2007 8:56 am 
Newbie

Joined: Sun Jul 30, 2006 3:54 am
Posts: 10
Hi Bertrand,
Thanks - I'm now using:
Code:
<add key="hibernate.dialect" value="NHibernate.Dialect.SQLite20Dialect, NHibernate.SQLite20" />
<add key="hibernate.connection.driver_class" value="NHibernate.Driver.SQLite20Driver, NHibernate.SQLite20" />


Which gets me further. However, with 'break on exceptions' on, I then got an error saying that assembly System.Data.SQLite could not be found.

When I copied System.Data.SQLite.dll into my runtime directory, I got an error saying:

Quote:
A first chance exception of type 'System.BadImageFormatException' occurred in mscorlib.dll

Additional information: The format of the file 'System.Data.SQLite' is invalid.


I presume that this is because System.Data.SQLite.dll is a .NET 2.0 (or ADO.NET 2.0?) assembly, but I'm running .NET 1.1.

The original post on this dialect implied that this dialect will work with .NET 1.1 - so I've either misinterpreted the original post, or I'm missing a DLL or config.

Any thoughts?

Thanks,

James


Top
 Profile  
 
 Post subject: Porting Sqlite 3 to Nhibernate 1.0.3
PostPosted: Tue Jan 29, 2008 2:52 pm 
Newbie

Joined: Tue Jan 29, 2008 2:49 pm
Posts: 1
I need NH 846 and jira is down. Can anyone help me with it. Thanks
Andres


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