hi everyone.
i' ve got the same problem, but with a slightly different mapping of the many-to-many relationship: in fact i used an idbag to realize a unidirectional many to many relationship from father to children, allowing multiple instance of the same child to be added and treated correctly in the collection.
here it is the mapping i' ve got (i' ve changed class names for better comprehension ):
-> Hibernate 2.1.6 <-
<class name="Father" table="father" mutable="true">
<id name="id" column="fat_id" type="java.lang.Integer" >
<generator class="native">
......
</generator>
</id>
......
<idbag name="children" table="father_son" lazy="false" outer-join="true" cascade="all" >
<collection-id type="java.lang.Integer" column="fat_chi_id">
<generator class="hilo">
</generator>
</collection-id>
<key column="fat_id"/>
<many-to-many column="chi_id" class="Child" outer-join="true"/>
</idbag>
</class>
<class name="Child" table="child" mutable="true">
<id name="id" column="chi_id" type="java.lang.Integer" >
<generator class="native">
.......
</generator>
</id>
.........
</class>
well, as previously reported, a delete command called on a Father persistent object actually remove both the link table entries and the "child" table ones.
I think this is an unwanted behavior, isn' t it?
I appriciate further contribution.
Thanks.
_________________ ~ Luca Ghirotti ~
Technology Reply
|