I am using NHibernate and have a cache region specified in my NHibernate configuration:
<cache region="HalfHour" expiration="1800" priority="3" />
I have an entity definition (UserDefinedGroup
) which is set to use this cache region in read-write mode:
<class name="UserDefinedGroup" table="Message_Groups">
<cache region="HalfHour" usage="read-write" />
...
</class>
I also have an HQL query that is set to use the query cache as it returns a large number of UserDefinedGroup instances:
var results = Session.CreateQuery("from UserDefinedGroup order by Name")
.SetCacheable(true)
.SetCacheRegion("HalfHour")
.List<UserDefinedGroup>();
However, when I try and delete an instance of UserDefinedGroup
I receive the following error even though the entity is set to use read-write cache.
ReadOnlyCache: Can't write to a readonly object Cristal.Model.UserDefinedGroups.UserDefinedGroup
Am I completely missing the point or misunderstanding NHibernate caching here? I'd expect this to perform the delete and the cache take care of itself appropriately, but clearly this is not happening.
Is this cache region used by any other entities? If so, are there usages of the cache that are read-only? A specific region should only have one usage type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With