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?
une 2 one to many and an intermediary entity. Check the hibernate reference doc for more info