Hi All
I am using hibernate 2.0.I am facing some problem with bidirectional relationship.
Here is my mapping file contents.
<class name="com.Text" table="TEXT">
<meta attribute="class-description">
Text
</meta>
<id name="sysKey" type="int" column="TEXT_SYSKEY">
<meta attribute="scope-set">public</meta>
<!-- This generator is used when the primary key is a natural key instead of a surrogate key-->
<generator class="native"/>
</id>
<property name="version" column="VERSION" type="int"/>
<property name="size" type="int"/>
<set name="Types" table="Types_Text_ASSOC" inverse="false" lazy="true" cascade="save-update">
<meta attribute="field-description">Types Associated with Text through Type_Text_Assoc table</meta>
<key column="TEXT_SYSKEY"/>
<many-to-many column="TYPE_SYSKEY" class="com.Type"/>
</set>
</class>
I am having collection Types in my class ,that is created for representing association between Type & Text.
Everything is working fine.But when i am updating the types of a Text object it is deleting all recrods from Type_Text_Assoc table and then inserting again.
It is not updating the data in table ,it should update the exiting and delete/insert other nwe/old elements.
It is a problem for me because a trigger is on my database on delete of any row from Type_Text_assoc table
Waiting for response
Regards
Sudhir
|