Hi all!
I have fetching problem. I try to get data with ISession.Get method, but it always returns null. If I use ISession.Find instead and give it the same id I gave the Get method it works and gets the row I wanted. My Id field is of type DateTime (I know it seems alerting, but please trust me, I know what 'm doing..) and I set it as 'assigned' so that I must set it myself every time I do Insert.
So, here's the pseudo for these two methods I tried:
Code:
//1st way: Get method:
DateTime id = DateTime.Now;
MyClass instance = (MyClass)session.Get(typeof(MyClass), id);
//Here the instance is null even it should be in the db..
//2nd way: Find method:
DateTime id = DateTime.Now;
IList list = session.Find("from MyTable WHERE Id = '" + id.ToString() + "'");
MyClass instance = (MyClass)list[0];
//Here the instance is okay!
So, what could be wrong is it that the Id field is DateTime? Or is there something I just don't see?
Thank You!
Yours,
Arto Kainu[/code]