Skip to content

Commit 0424fcc

Browse files
Document a requirement of caching with composite id.
1 parent ee8f87f commit 0424fcc

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

doc/reference/modules/component_mapping.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,12 @@
225225
notion of composite key equality.
226226
</para>
227227
</listitem>
228+
<listitem>
229+
<para>
230+
It should re-implement <literal>ToString()</literal> if you consider
231+
using the second level cache. See <xref linkend="NHibernate.Caches-howto" />.
232+
</para>
233+
</listitem>
228234
</itemizedlist>
229235

230236
<para>

doc/reference/modules/nhibernate_caches.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,12 @@
166166
transactions. Interacting with the data store without an explicit transaction is discouraged, and will
167167
not allow the second level cache to work as intended.
168168
</para>
169+
<para>
170+
To avoid issues with composite ids and some cache providers, <literal>ToString()</literal> needs to
171+
be overridden on composite id classes. It should yield an unique string representing the id. If the
172+
composite id is mapped as a component, overriding the component <literal>ToString()</literal>
173+
is enough. See <xref linkend="components-compositeid" />.
174+
</para>
169175
</formalpara>
170176
<para>
171177
See also <xref linkend="performance-cache" />.

0 commit comments

Comments
 (0)