Reputation: 25628
I am having trouble working out how to correctly cache one-to-many or many-to-many relationships in NHibernate.
For example, an office class may have the following mapping:
public OfficeDbMap()
{
...
HasMany(x => x.Employees)
.Cache.NonStrictReadWrite();
}
However I find that when I delete an employee (without specifically removing its relationship to the office), that the cache of office->employees does not get invalidated and the employee continues to appear in the office's list of employees.
I suspect it may have something to do with cache regions, but I don't know whether the region should be the office's region or the employee's region (actually I have tried specifying both and neither works).
Upvotes: 1
Views: 497
Reputation: 2000
The problem may be the NonStrictReadWrite
configuration.
You have to use the Read-Write strategy.
Upvotes: 1