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".
You're specifying mutable="false" and the cache for your set. Get rid of that.
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