views:

27

answers:

1

I am using castle active record, I load an enity using the .Find() method, after updating the database i call entity.Refresh() but the entity doesn't refresh, the data that i changed in the database is not reflected in the state of the entity. I am at a total loss as to how to get this to work.

A: 

This problem probably comes from a NHibernate cache.

In order to save database connection, if an object has been loaded from the database, it is kept in the cache (while not expired), and NHibernate will give you the cached value if you want to get this value.

If you do a dabase direct update, you won't see it in the application until the cache has expired.

To prevent that, if your base can be updated directly, you have to desactivate the NHibernate cache.

Benoit Courtine
I've had a look around and can't find how i can disable the cache, do you know how ?
Matthew