1. Persisting a SortedSet with dynamically-assigned Comparator forum.hibernate.orgHibernate version: 2.1 Mapping documents: TBD Code between sessionFactory.openSession() and session.close(): N/A Full stack trace of any exception that occurs: N/A Name and version of the database you are using: N/A Debug level Hibernate log excerpt: N/A Hi, I have a class (AttributeSet) that contains a SortedSet (attributeValues) that contains Strings. The AttributeSet class allows a Comparator class to be given ... |
2. SortedSet save problem forum.hibernate.orgSaving object employee with Sorted set as specified below public class Employee { /** * @hibernate.set table="employee_machines" cascade="none" inverse="false" sort="com.mrt.vend.desktop.model.AssignedMachine" * @hibernate.collection-key column="emd_emp_id" * @hibernate.collection-composite-element class="com.mrt.vend.desktop.model.AssignedMachine" */ .... } using code session.saveOrUpdate(employee); Hibernate tries to insert the existing row and falls over on database constraint key violation. It should delete the row first then insert new one. I tried employee.setAssignedMachineList(null); session.update(employee); ... |
3. SortedSet, why does it UPDATE every element? forum.hibernate.orgI've got an object, a Transfer. I have TransferEvents I add to it and these are sorted by the timestamp of the event. Why when I save the Transfer it INSERTs the new TransferEvent as expected. Yet Hibernate then also UPDATEs every TransferEvent as well. Why? Is there something I've done wrong in defining the set in the hibernate mapping? Hibernate ... |