I have searched around the forums and noticed people facing problems with relevant foreign keys not being entered in Many-to-Many Join Tables.
However, in my case zeros are being added into the Join Table. Data is being populated accurately into the two tables being joined.
Please find the mappings below. ts_task and ts_tag are the two tables joined by ts_task_tag.
Any help would be greatly appreciated.
Code:
<!-- Task mapping -->
<class name="com.test.techbase.tasker.Task" table="ts_task" lazy="true">
<id name="id" column="Id">
<generator class="assigned" />
</id>
<property name="name" column="Name" />
<property name="dateCreated" column="DateCreated" type="timestamp" lazy="true" />
<property name="dateDue" column="DateDue" type="timestamp" lazy="true" />
<property name="dateCompleted" column="DateCompleted" type="timestamp" lazy="true" />
<property name="note" column="Note" type="text" lazy="true" />
<bag name="tags" table="ts_task_tag" lazy="false" cascade="all" inverse="false">
<key column="TaskId" />
<many-to-many column="TagId" class="com.test.techbase.tasker.Tag" />
</bag>
</class>
<!-- Tag mapping -->
<class name="com.test.techbase.tasker.Tag" table="ts_tag">
<id name="id" column="Id">
<generator class="assigned" />
</id>
<property name="name" column="Name" unique="true" />
<property name="dateCreated" column="DateCreated" type="timestamp" lazy="true" />
</class>