Hi,
I have a SortedSet with the following comparator (specified in code and in the mapping file)
Code:
public class CloseDateDescComparator implements Comparator<Order> {
public int compare(Order o1, Order o2) {
int i = o1.getCloseDate().compareTo(o2.getCloseDate());
if (i==0) i =-1;
return i;
}
}
This SortedSet is a field on a SalesEmployee (called deals). This deals is mapped as a unidirectional one-to-many:
Code:
<set name="deals" cascade="all,delete-orphan" sort="demos.inheritance.single.CloseDateDescComparator">
<key column="SALES_ID"/>
<one-to-many class="demos.inheritance.classtable.Order" />
</set>
When i add two orders to the Set with the same closeDate, the first to insert has NULL has it's SALES_ID (the second correctly has the SALES_ID set to the corresponding ID of the SalesEmployee).
Any thoughts?
Tx.,
Raphael