0

I am using NHibernate and this error appears when I use Get method of Session.

This is my code:

public T GetById(object id)
    {
        T entity;
        entity = (T)ReportHttpModule.CurrentSession.Get(typeof(T), id);
        return entity;
    }

note that I don't get this error when use CreateCriteria(T) before calling that method!

alisabzevari
  • 8,008
  • 6
  • 43
  • 67

1 Answers1

0

I've found the solution. It is weird but it was a problem in mapping file. One of my columns had not-null="true" in mapping file but in database was not nullable!

alisabzevari
  • 8,008
  • 6
  • 43
  • 67