views:

301

answers:

3

When debugging everything appears good. The insert commits and there is no roll back, no exceptions. I sure hope some can help with this.

Here is my call:

using (ITransaction transaction = _session.BeginTransaction())
       {

           _session.Save(calc);
           transaction.Commit();
       }

Real simple mapping:

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
               assembly="SigCalculator"
               namespace="SigCalculator.Domain">

<id name="ID">
  <generator class="guid" />
</id>
<property name="Time" />
<property name="Equation" />

here's the object:

public class Calculation
{
    public virtual Guid ID { get; set; }
    public virtual DateTime Time { get; set; }
    public virtual string Equation { get; set; }

}
A: 

What happens if you call:

session.Flush();

before the transaction Commit? What is your application's FlushMode set to?

Scott Muc
A: 

I tried the following.. nothing changed.

public void AddCalc(Calculation calc) { using (ITransaction transaction = _session.BeginTransaction()) {

           _session.Save(calc);
           _session.Flush();
           transaction.Commit();
       }



   }
Nick
+1  A: 

I'm a bonehead! Make sure you set your PK to a... PK..

Shheesh.. I need to take a break :)

Nick
Hehe, mistakes like that happen to us all.
Scott Muc