Good evening to everyone :)
I recently upgraded NHibernate from 0.99.2.0 to 1.0.1.0 and JetDriver from a version downloaded about a month ago from here
http://jira.nhibernate.org/browse/NH-437
to the one contained on NHibernate-Contrib 1.0.1 (maybe it's the same release, but i'm not sure).
I'm working on a MSAccess-based application that, until this upgrade, was working fine. What i'm experiencing is that, everytime I try to persist a new class that has a Increment ID, I get an invalid cast exception. I tried it with a very simple example like this
Class:
Code:
public class SimpleItem
{
public SimpleItem()
{
}
#region Private members
private int id;
private string description;
#endregion
#region Public props
public int ID
{
get{return id;}
set
{
if (value != id)
{
id = value;
}
}
}
public string Description
{
get{return description;}
set
{
if (value != description)
{
description = value;
}
}
}
with this mapping
Code:
<class name="SimpleItem" table="Test">
<id name="ID" column="ID" type="Int32">
<generator class="increment" />
</id>
<property name="Description" column="Description" />
</class>
The DB Field is a long integer data type.
What I exactly get is a NHibernate.ADOException, with the following stack trace:
Quote:
NHibernate.ADOException: Could not save object ---> System.InvalidCastException: Cast specificato non valido.
at System.Data.OleDb.OleDbDataReader.GetInt64(Int32 ordinal)
at NHibernate.Id.IncrementGenerator.getNext(ISessionImplementor session)
at NHibernate.Id.IncrementGenerator.Generate(ISessionImplementor session, Object obj)
at NHibernate.Impl.SessionImpl.SaveWithGeneratedIdentifier(Object obj, CascadingAction action, Object anything)
I've highlighted the thing that makes me suspicious that something strange is going on with Int64 type (but I'm not using it anywhere!!)
What can I do? has someone experienced the same behaviour?
Thanks in advance!!