When given following mapping:
<class name="SomeClass">
<id name="id" column="IDsome_class" type="integer">
<generator class="native"></generator>
</id>
<property name="attrA" />
<version name="version">
</version>
<component name="componentA" class="whatever">
<component name="componentB" class="whatever">
<list name="underlyingList" table="items">
<key>
<column name="FKsome_class" not-null="true" />
</key>
<index column="idx"/>
<many-to-many column="FKitem" class="whatever"/>
</list>
</component>
</class>
When property attrA gets changed everything is fine - version is upgraded, interceptor is called. However if componentA gets changed the change itself is saved, but version remains uchanged and interceptor is not called.
Note that this case shows componentA which contains only another component (componentB). Situation changes when componentA gets some simple property like this:
<class name="SomeClass">
<id name="id" column="IDsome_class" type="integer">
<generator class="native"></generator>
</id>
<property name="attrA" />
<version name="version">
</version>
<component name="componentA" class="whatever">
<property name="someProperty" />
<component name="componentB" class="whatever">
<list name="underlyingList" table="items">
<key>
<column name="FKsome_class" not-null="true" />
</key>
<index column="idx"/>
<many-to-many column="FKitem" class="whatever"/>
</list>
</component>
</class>
Now, if componentA gets changed everything works fine again - version gets incremented and interceptor is called. It doesn't matter if someProperty gets changed or remains unchanged. It is enough that it exists.
|