As stated I'm new to NHibernate. I've gotten the Cat example to work, but when I tried to get a simple class working with my actual data I came across a problem that I'm hoping someone can help me with.
Keep in mind that I'm not an SQL Server expert, being more familiar with MySQL.
I'm using NHibernate-1.2.0Beta2 with MS SQLServer 2000, and the site is using ASP.Net 2.0 which I'm editing with Web Developer Express.
In a nutshell I've defined my schema, placed the assemblies, etc, but it keeps trying to insert a null for the primary key.
Here's the relevant bits:
schema
Code:
<class name="PhoneNumber" table="mega_phone_numbers">
<id name="id">
<column name="id" sql-type="int" not-null="true" unique="true"/>
<generator class="identity"/>
</id>
POCO class
Code:
public virtual int id
{
get { return _id; }
set { _id = value; }
}
The primary key is setup as an int identity with an increment of 1.
Whenever I attempt to insert into the table I get the following error:
Code:
Cannot insert the value NULL into column 'id', table 'mega_test_db.dbo.mega_phone_numbers'; column does not allow nulls. INSERT fails.
----------------------------
Also note the sql-type. I tried to use type="Int32" but it kept giving me an error about it not being supported.
I've been banging my head against this problem for several hours now so any advice would be greatly appreciated.