Hibernate version: 2.0.3
Mapping documents:
<hibernate-mapping>
<class name="test.Item" table="item">
<id name="uid" column="uid" type="integer" unsaved-value="any">
<generator class="increment"/>
</id>
...
<many-to-one class="test.Status" column="status" name="status" insert="true" update="true" cascade="save-update"/>
...
</class>
</hibernate-mapping>
<hibernate-mapping>
<class name="test.Status" table="status">
<id name="uid" column="uid" type="integer" unsaved-value="none">
<generator class="increment"/>
</id>
...
<one-to-one name="item" class="test.Item" property-ref="puid"/>
<property name="text" column="text" type="string" insert="false" update="false"/>
...
</class>
</hibernate-mapping>
Name and version of the database you are using: MySQL
First off, Hibernate has worked wonders for me, and I truly appreciate it...
My problem:
I have a set containing Item(s) which have a Status associted with them. The relationship from Item to Status is many-to-one. Status is just an enumeration that can be any of three different values. In my form there can be more than one Item.
When two different items have the same Status value the "NonUniqueObjectException: a different object with the same identifier value was already associated with the session:x, of class: Status".
I have looked in HIA, documentation, and forum, but haven't found an answer so far.
How do I get around this error?
|