tags:

views:

71

answers:

1

How do I re-read some (class) Items from the database? I have read them once and made same updates, updates I dont wont to save. Now I need a complete fresh collection of Items from the database.

I have noticed that there are a function called SetForceCacheRefresh, but how do I use it with a CreateCriteria?

// Mats

+1  A: 

IList list = null; using (Repository rep = new Repository()) { IQuery iqry = rep.Session.CreateQuery(hql);
iqry.SetForceCacheRefresh(true); list = iqry.List(); }

Note: Before calling List(), set SetForceCacheRefresh(true) to refresh.