I have the following code. In SQL Server profiler I can see the isnert statement being generated however no actual record has been inserted. I just can't figure out why this is happening!
private ISessionFactory _sessionFactory;
private Configuration _configuration;
_configuration = new Configuration();
_configuration.Configure();
_configuration.AddAssembly(typeof(Task).Assembly);
_sessionFactory = _configuration.BuildSessionFactory();
using (var s = _sessionFactory.OpenSession())
using (var t = s.BeginTransaction(IsolationLevel.RepeatableRead))
{
var taskToSave = new Task
{
Class = "test class",
IsActive = true,
Namespace = "test namespace"
};
s.FlushMode = FlushMode.Commit;
s.Save(taskToSave);
t.Commit();
}
My mapping file is like this:
<class name="Task" table="Task">
<id name="Id" column="Id" unsaved-value="0" type="Int32">
<generator class ="identity"></generator>
</id>
<property name="IsActive" column="IsActive" not-null="true" type="Boolean" />
<property name="Namespace" column="Namespace" length="255" not-null="true" type="String" />
<property name="Class" column="Class" length="255" not-null="true" type="String" />
</class>
Thank you! BTW I am using NHibernate-2.1.0.CR1.