-->
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: many-to-many association
PostPosted: Wed Oct 04, 2006 3:45 am 
Newbie

Joined: Mon Sep 25, 2006 8:35 am
Posts: 5
hi,
i must implement a many-to-many association with an attribute put in the bridge table.
as example, i have one table "Student" and one table "Courses". I wish to model the set of examinations for each students like that:

create table Student(studentId string,....)
create table Course(courseId string,...)
create table StudentExams(studentId not null, courseId not null, vote string)
where (studentId,courseId) is the primary key.

<class name="Student">
<id name="id" column="studentId">
<generator class="native"/>
</id>
<set name="examinations" table="StudentExams">
<key column="studentId"/>
<many-to-many column="courseId"
unique="true"
class="Course"/>
</set>
</class>

<class name="Course">
<id name="id" column="courseId">
<generator class="native"/>
</id>
</class>

my question is: how can I get the "vote" field for each student-course association? Must I create an XML file to map the StudentExam table?


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.