views:

293

answers:

1

I have a three tables: User, Course, and Test.

Course has a User foreign key and Test has a Course foreign key. I am having trouble mapping the Test collection for each User since I need an intermediary step from User -> Course -> Test. I am trying to use a SecondaryTable since the User key for the Test is its associated Course row.

Am I on the right track using SecondaryTable or is there a way to use a JoinTable without the inverseJoinColumn?

A: 

Am I on the right track using SecondaryTable or is there a way to use a JoinTable without the inverseJoinColumn?

I don't think so, specifying secondary tables indicates that the entity's persistent data is stored across multiple tables, which is not exactly the case here.

But it's hard to say more without seeing your entities, the relationships. And by the way, do you have the control of the database (i.e. can you change things)?

Pascal Thivent
How would I structure a JoinTable in this case? I do have influence over the schema. I would show you the entities, but I am pretty sure they are part of the problem. The main issue here is the fact that I want to get a collection of students from each course in a collection of courses.
Smithers
@Smithers If you can modify the schema, just model it like you want to use it at the object level. What you are trying to do is just too cumbersome IMHO.
Pascal Thivent