Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I get the "read-only cache configured for mutable" when building NHibernate session factory?

I have set a simple model: Document entity with multiple images. Images are saved in another database, and they are updated from other legacy application, so my app has only readonly access. I setup a synonim so that I can use the images table on another server as a local table. My mappings are the following:

<class name="Image" mutable="false" table="ImageExternal">
    <cache region="images" usage="read-only" />
    <id name="Id">
      <generator class="assigned" />
    </id>   
    <property name="Name" update="false" />
    <!-- other properties -->
</class>
<class name="Document" table="Document">    
    <id name="Id">
       <generator class="guid.comb" />
    </id>
    <!-- other properties -->
    <set name="Images" mutable="false">
      <cache region="images" usage="read-only" />
      <key column="some_guid_column" />      
      <one-to-many class="Image" />
    </set>
</class>

The image class itself is mutable, but I can make it immutable by changing the access strategy to protected fields. I set mutable="false" on the Image mapping, all its properties have update="false" and Images set in the parent relationship is also marked with mutable="false". However when building the session factory I get the "read-only cache configured for mutable: images" warning because the cache usage is "read-only".

like image 351
Vasea Avatar asked Nov 05 '22 03:11

Vasea


1 Answers

You're specifying mutable="false" and the cache for your set. Get rid of that.

like image 143
Vadim Avatar answered Nov 15 '22 08:11

Vadim