JPA Secondary Table Issue
I have a three tables: User, Course, and Test.
Course has a User foreign key and Test has a 开发者_JAVA百科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?
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)?
精彩评论