I'll answer my own question:
I wrote a comparator for persistent classes
Code:
import java.util.Comparator;
import org.simplecart.shopcart.model.Persistent;
/**
*
* @author Daniel Watrous
*/
public class PrimaryKeyComparator implements Comparator {
public int compare(Object obj1, Object obj2) {
int result;
Persistent pobj1 = (Persistent) obj1;
Persistent pobj2 = (Persistent) obj2;
// return this result
return pobj1.getId().compareTo(pobj2.getId());
}
public boolean equals(Object obj) {
return this.equals(obj);
}
}
and I modified my mapping as follows:
<set name="products"
table="PRODUCT"
inverse="true"
lazy="true"
cascade="save-update"
sort="org.simplecart.shopcart.model.PrimaryKeyComparator">
<key column="CATEGORY_ID"/>
<one-to-many class="Product"/>
</set>