-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: question on mapping of one-to-many
PostPosted: Sat Mar 27, 2004 6:12 pm 
Newbie

Joined: Tue Mar 02, 2004 10:56 pm
Posts: 12
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.