Pretty simple question. Why does this exception get thrown when I call Save on my ISession?
This is happening in a Unit test using FluentNHibernate 1.2 with NHibernate 3.0.
My class is really simple:
public class Spooge
{
public virtual long Id { get; set; }
public virtual string Name { get; set; }
}
My mapping class is equally simple:
public class SpoogeMapping : ClassMap<Spooge>
{
public SpoogeMapping()
{
Table("spooges");
Id(x => x.Id)
.GeneratedBy
.Sequence("spooges_seq");
Map(x => x.Name)
.Column("name")
.Not.Nullable();
}
}
I build my session factory like this:
sessionFactory = Fluently.Configure()
.Database(connectionCfg)
.Mappings(m => m.FluentMappings.AddFromAssembly(Assembly.GetExecutingAssembly())
.ExportTo("c:\\temp"))
.ExposeConfiguration(x => x.SetProperty("current_session_context_class", "thread_static"))
.BuildSessionFactory();
and the generated hbm.xml file looks like this:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-access="property" auto-import="true" default-cascade="none" default-lazy="true">
<class xmlns="urn:nhibernate-mapping-2.2" mutable="true" name="Tx.Tests.Spooge, Tx.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" table="Spooges">
<id name="Id" type="System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<column name="Id" />
<generator class="sequence">
<param name="sequence">spooges_seq</param>
</generator>
</id>
<property name="Name" type="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<column name="name" not-null="true" />
</property>
</class>
</hibernate-mapping>