1 Reply Latest reply on Sep 30, 2005 6:45 AM by epbernard

    Composite element with nested <many-to-one> element

    janbols

      How can I define an entity having a composite element with a nested <many-to-one> element. Doing this in hibernate made it possible to map extra columns of a many-to-many association table to the composite element class. However I don't know how this is done in ejb3 and how to annotate this.

      Let me explain what I want to do:
      I have 3 tables...
      create table student (
      id number primary key
      )
      create table course(
      id number primary key
      )
      create table student_course(
      student_id number foreign key references student (id)
      , course_id number foreign key references course(id)
      , examresults number
      )

      What's the best way to map this into the OO world. The problem is that the student_course has an examresults field. I can't just use @ManyToMany in the student class to get a List of Courses with examresults can I?