I am trying to fetch a list from my database fulfilling a given criterion. The statement I am using is : var products = session .CreateCriteria(typeof(Product)) .Add(Restrictions.Eq("Category", category)) .List();
Where, product is my Domain object session is the current active session.
Whenever I use this statement, NHibernate queries the database everytime to fetch me the list instead of doing it just the 1st time and then returning me the result from the cache from 2nd time onwards. Is there anything I am doing incorrect?