jchapman wrote:
I'm guessing this is because you have not yet flushed the session containing these objects. You can't possibly run an HQL query (which actually runs against your database) and expect it to retrieve records which don't exist.
The reason why Get would work is that for any get/load it actually checks the session's identity map (first level cache) first, and if it is found there will return it. Therefore, you will not need to make the database call, and will still receive the item.
Now, by default NHibernate actually flushes the items of the type you are querying for before you run a query, however, you have set FlushMode to Never, therefore NHibernate will not flush these changes for you automatically.
In this case you either need to flush the session, or perform the filtering in memory.
Hi jchapman,
The programmer that uses this funcionality, found a way to use the "Get" method and the problem is solved. Thanks!