i am using struts/hibernate; i would like to use list collection implementation as it appears this is preferred up the stack...
this is pretty straight forward mapping, but i am not understanding which of my many options i should choose.
I have 3 classes:
Event
(eventid int,
...)
Participant
(participantid int,
...)
EventParticipant
(eventid,
participantid,
...)
i am confused on how to map my list in the event mapping to the eventparticipant table. i have:
<list name="eventparticipants" ... >
<key column="eventid"/>
<index column="??"/>
<one-to-many class="eventparticipant"/>
</list>
what is my index column? reading docs leaves me understanding it needs to be an integer, but i am not sure if it refers to the index in the foreign table, or? so, i would think it should be eventid (as this is the index in eventparticipant), but this gives me a duplicate field error in the hibernate loading.
this is very similar to the parent-child relationship at the end of the doc in section 6.12 - but they use Set, not List.
should i be using a different index? or, should i be using a bag?
please show me what my mapping to eventparticipants should look like, and if you have a minute, what my mapping in eventparticipant to event should look like.
|