Hi.
I tried to implement a relation between two tables (Tag, Category), many-to-many through a third table. The third table also contains boolean field "isActive", besides keys from other tables.
There is a problem when performing an integration (union) test. This test should to create a relation, and then read these changes from DB - as a result both instance of the tables' classes should contain the new relation. Actually only the class, which has produced a storing, knows about new relation. Reading and filling of containers by the prepared records from the database are correct, the problem bound only with the simultaneous read-write.
P.S. I can send the project's source code to anybody who will take an interest to this problem.
Mapping:
Code:
<class name="Category">
<id name="Id">
<generator class="native"/>
</id>
<property name="Name" />
<many-to-one name="Parent" column="ParentId" not-null="false" cascade="save-update" />
<set name="Children">
<key column="ParentId"/>
<one-to-many class="Category" />
</set>
<set name="CategoryTags">
<key column="CategoryId" />
<one-to-many class="CategoryTag" />
</set>
</class>
<class name="Tag">
<id name="Id">
<generator class="identity"/>
</id>
<property name="Name" />
<set name="CategoryTags">
<key column="TagId" />
<one-to-many class="CategoryTag" />
</set>
</class>
<class name="CategoryTag" table="Category_Tag">
<composite-id name="Key" class="CategoryTagKey">
<key-many-to-one name="Tag" column="TagId" class="Tag" />
<key-many-to-one name="Category" column="CategoryId" class="Category"/>
</composite-id>
<property name="isActive" type="bool"/>
</class>