I'm putting together an example demo for some students (like I'm the expert :-\) and I'm using XDoclet, Tomcat, and MySQL for it all.
Person, abstract class extended by (joined-subclass) Teacher and Student, with just an extra field in each, such as Course and Grade to show the polymorphism.


I'd like to have a bidrectional many-to-many collection, a Teacher has a set of Students, a Student has a set of teachers, basically I need a teacher_student(teacherId, studentId) relation table. In the @hibernate tags in Teacher.java:

   /**
    * Set the set of students
    * @hibernate.set
    *      inverse="true" lazy="true"  table="teacher_student"
    *  @hibernate.collection-many-to-many
    *      unique="false"
    *      class="csusb.Student"
    *  @hibernate.collection-key
    *      column="studentId"
    *
    * @return java.util.Set
   */
   public void setStudents(Set students) {
       this.students = students;
   }

A similar thing is done in Student.java, except of course I turn around the classes.
create table teacher_student (
studentId INTEGER not null,
elt INTEGER not null,
teacherId INTEGER not null,
primary key (teacherId, elt)
);
is generated by schemaexport. What is that ELT! How can I get rid of it, what @hibernate tag or value am I missing?







------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to