Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: hibernate-3.2.5
Mapping documents:
Code:
<class name="Account">
<list name="albums" cascade="save-update" inverse="false">
<cache usage="nonstrict-read-write"/>
<key column="accountId" not-null="true" update="false"/>
<list-index column="position"/>
<one-to-many class="Album"/>
</list>
</class>
<class name="Album">
<cache usage="nonstrict-read-write"/>
<id name="id" column="id" type="int">
<generator class="increment"/>
</id>
<many-to-one name="account" column="accountId" not-null="true" insert="false" update="false"/>
</class>
This is my mapping file
An account has a list of Album
When an album is deleted , the POSITION column is not re-ordering.
When an new Album is inserted , the POSITION value will equal the max.
If Account acc has Albums 0,1,2,3
If album0 is removed , the POSITION is still 1,2,3 (not 0,1,2)
If a new album is appended , the POSITION becomes 1,2,3,3
"3" is duplicated !!!
It seems the problem has been proposed many times , different people have different setting , but I cannot find a working solution...
Can some body help me ! thank you very much....