I've similar problem.
here is my mapping:
Code:
<?xml version="1.0" encoding="utf-16"?>
<hibernate-mapping xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:nhibernate-mapping-2.0">
<class name="TestSQLite.Utente, TestSQLite" table="Utenti" lazy="false">
<id name="NUid" access="property" column="NUid" type="Int32" unsaved-value="0">
<generator class="native">
</generator>
</id>
<property name="Uid" access="property" column="Uid" type="Int16" />
<property name="UserName" access="property" column="name" type="String" />
<property name="FlgAttivo" access="property" column="FlgAttivo" type="Boolean" />
<property name="InsUser" access="property" column="InsUser" type="String" />
<property name="InsData" access="property" column="InsData" type="System.DateTime" />
<property name="ModUser" access="property" column="ModUser" type="String" />
<property name="ModData" access="property" column="ModData" type="System.DateTime" />
</class>
</hibernate-mapping>
When I try to save my model I receive the following error:
Code:
TestCase 'TestSQLite.TestUtente.TestInserimentoUtente' failed: Castle.ActiveRecord.Framework.ActiveRecordException : Could not perform Save for Utente
----> NHibernate.ADOException : Could not save object
----> Finisar.SQLite.SQLiteException : no such table: hibernate_unique_key
d:\progetti\castle\activerecord\castle.activerecord\framework\activerecordbase.cs(333,0): at Castle.ActiveRecord.ActiveRecordBase.Save(Object instance)
d:\progetti\castle\activerecord\castle.activerecord\framework\activerecordbase.cs(838,0): at Castle.ActiveRecord.ActiveRecordBase.Save()
d:\progetti\testsqlite\testutente.cs(19,0): at TestSQLite.TestUtente.TestInserimentoUtente()
--ActiveRecordException
at NHibernate.Impl.SessionImpl.SaveWithGeneratedIdentifier(Object obj, CascadingAction action, Object anything)
at NHibernate.Impl.SessionImpl.Save(Object obj)
at NHibernate.Impl.SessionImpl.SaveOrUpdate(Object obj)
d:\progetti\castle\activerecord\castle.activerecord\framework\activerecordbase.cs(320,0): at Castle.ActiveRecord.ActiveRecordBase.Save(Object instance)
--ADOException
at Finisar.SQLite.sqlite3.Throw()
at Finisar.SQLite.sqlite3.compile(String zSql)
at Finisar.SQLite.OneSQLStatement.Compile()
at Finisar.SQLite.SQLiteDataReader.ExecuteFirstStep()
at Finisar.SQLite.SQLiteDataReader.Read()
at NHibernate.Id.TableGenerator.Generate(ISessionImplementor session, Object obj)
at NHibernate.Id.TableHiLoGenerator.Generate(ISessionImplementor session, Object obj)
at NHibernate.Impl.SessionImpl.SaveWithGeneratedIdentifier(Object obj, CascadingAction action, Object anything)
0 passed, 1 failed, 0 skipped, took 6.83 seconds.
But if I change the generator to <generator class="identity"> all work fine.
Where could I tell to NH that for SQLite the Native generator should use identity generator?
In the meantime I look at the code...
Bye,
Antonio.