Hi,
I have mapping (using Hibernate 2.1.8) of the child table as a set, with key and composite-element.
e.g.
[quote]<set ... sort="natural" ... cascade="all">
<key>
<column name="ID"/>
</key>
<composite-element class="Element">
<property name="nbr1" column="NBR1"/>
<property name="nbr2" column="NBR2"/>
</composite-element>
</set>[/quote]
But the property nbr2 can be null. And when I try to delete this elements from the set they are not removed from the DB2 database because the:
delete from ..... where .... NBR2=?
and seting the last parameter to NULL using preparedStatement.setNull(3, java.sql.Types.INTEGER) is not working! This is DB2 feature or it is common?
The only way out of this problem is to use map instead of set. There can i specify composite-index (all properties are not null) and composite-element, where can be null properties.
[quote]<map ... sort="natural" ... cascade="all">
<key>
<column name="ID"/>
</key>
<index column="NBR1"/>
<composite-element class="Element">
<property name="nbr2" column="NBR2"/>
</composite-element>
</map>[/quote]
BUT, i like the set behaviour, where I have all properties in 1 class. So is there any way how to add the index into the mapping of Element class?
Thanks,
Jirka
|