there seems to be some confusion as to whether version 3 does support list with inverse="true" without manually taking care of index.
I have the follow parent child, User - Event
<hibernate-mapping default-lazy="false" >
<class name="model.User" >
<id name="userId" type="int" column="USERID">
<generator class="native" />
</id>
<list name="events" cascade="all-delete-orphan" inverse="true" >
<key column="USERID" not-null="true" />
<list-index column="eventsIdx"/>
<one-to-many class="model.Event"/>
</list>
</class>
</hibernate-mapping>
<hibernate-mapping >
<class name="model.Event" >
<id name="objectId" type="int" column="OBJECTID">
<generator class="native" />
</id>
<many-to-one name="user" class="model.User" column="USERID" not-null="true" />
<property name="location" column="LOCATION" />
</class>
</hibernate-mapping>
after adding a new Event to User, I can save by either the parent of the child, but eventsIdx is NULL.
Please tell me whether this mapping is correct for hibernate 3.2.
|